분류 전체보기
-
Rails에 Rollbar 설치하기Ruby, Rails 2021. 6. 26. 13:29
https://docs.rollbar.com/docs/rails Rollbar를 이용하면 Rails controller에서 처리하지 못한 exception을 자동으로 report해줍니다. 주의 만약 global exception handler를 사용하신다면, Rollbar.error(e) 를 명시적으로 불러줘야 합니다. 1. rollbar gem 추가 gem 'rollbar' 2. 초기화 > rails generate rollbar POST_SERVER_ITEM_ACCESS_TOKEN
-
[javascript prototype] Prototype을 이용한 상속React, Javascript 2021. 6. 20. 17:48
아래 Circle class는 duplicate 을 prototype property로 가지고 있습니다. Square class에도 동일한 기능을 구현해야 한다면 반복적으로 duplicate을 추가해야 될까요? Shape 이라는 class를 만들고, duplicate을 Circle 과 Square에 모두 사용할 수 있게 할 수 있는 방법을 고민해 봅시다. function Shape() { } function Circle(radius) { this.radius = radius; } Circle.prototype.duplicate = function() { console.log("duplicate"); } function Square() { } javascript에서 object를 통해 method를 요청하..
-
[ Javascript Prototype ] 2. Prototype property & instance memberReact, Javascript 2021. 6. 20. 17:23
아래 Circle class에는 instance member로 draw 메소드가 있다. function Circle(radius) { this.radius = radius; this.draw = function() { console.log('draw') } } Circle class로 만든 객체 c1, c2 는 draw function을 instance method로 가지게 된다. const c1 = new Circle(1); const c2 = new Circle(2); draw method를 c1, c2의 prototype인 Circle에 추가하려며 어떻게 해야 될까? c1.__proto__ == Circle.prototype // true c1의 prototype은 Circle.prototype 으..
-
Mimemagic - Could not find MIME type database in the following locations:Ruby, Rails 2021. 6. 14. 03:32
#27 402.0 Gem::Ext::BuildError: ERROR: Failed to build gem native extension. #27 402.0 #27 402.0 current directory: #27 402.0 /usr/local/lib/ruby/gems/2.6.0/gems/mimemagic-0.3.10/ext/mimemagic #27 402.0 /usr/local/bin/ruby -rrubygems #27 402.0 /usr/local/lib/ruby/gems/2.6.0/gems/rake-13.0.0/exe/rake #27 402.0 RUBYARCHDIR\=/usr/local/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/mimemagic-0.3..
-
[ Javascript Prototype ] 1. Prototype ChainReact, Javascript 2021. 6. 11. 13:44
모든 Javascript object는 prototype object를 가지고 있습니다. Prototype 으로 연결된 object들을 prototype chain이라고 하고, object의 attribute(속성) 이나 method(메소드)를 탐색할 때 이 chain을 따라 올라가면서 탐색합니다. Prototype chain의 끝엔 prototype이 없는 objectBase가 있으며, Javascript의 모든 object는 objectBase를 prototype chain으로 가지고 있습니다. Console에서 객체의 Prototype을 확인하려면 __proto__ 을 사용합니다. __proto__ 는 deprecated 되었으니, 코드에서 prototype을 확인하려면 `Object.getProt..
-
Django Shell에서 자주쓰는 기능 10가지Python, Django 2021. 6. 3. 15:12
1. refresh_from_db 데이터베이스에서 값을 새로 가져오고 싶을 때 사용합니다. 아래 예제처럼, update를 하고 나서 데이터베이스에 값을 다시 확인하고 싶을 때 사용합니다. def test_update_result(self): obj = MyModel.objects.create(val=1) MyModel.objects.filter(pk=obj.pk).update(val=F('val') + 1) # At this point obj.val is still 1, but the value in the database # was updated to 2. The object's updated value needs to be reloaded # from the database. obj.refresh_f..