This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://blog.codeclimate.com/blog/2012/10/17/7-ways-to-decompose-fat-activerecord-models/ | |
O rly? Duplikacja atrybutów, duplikacja walidacji, pozdro z walidacja typu uniqueness of albo cokolwiek innego co hituje bazy per model. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if has("autocmd") | |
" remove trailing white spaces | |
autocmd BufWritePre * :%s/\s\+$//e | |
endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Installing therubyracer (0.11.1) with native extensions | |
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. | |
/home/ubuntu/.rvm/rubies/ruby-1.9.3-p327/bin/ruby extconf.rb | |
checking for main() in -lpthread... yes | |
creating Makefile | |
make | |
compiling script.cc | |
compiling handles.cc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-# taka pierda, że aż funkcje jakąś trzeba wywołać /facepalm | |
= surround '(', ')' do | |
= value | |
-# ja pierdole, jak to ssie | |
= "(#{value})" | |
-# nawet nie wiem czy to zadziała, bo się pewnie na parsowaniu wyjebie |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Response.new(self, last_response, lambda{}, {body: ""}) | |
=> nil | |
Response.new(self, last_response, lambda{}, {body: ""}).nil? | |
=> true | |
Response.new(self, last_response, lambda{}, {body: ""}).class | |
=> HTTParty::Response | |
Response.new(self, last_response, lambda{}, {body: ""}) == nil | |
=> false | |
Response.new(self, last_response, lambda{}, {body: ""}) === nil | |
=> true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Example; def inspect; raise "whatever"; end; end; | |
Example.new | |
RuntimeError: whatever | |
from (irb):1:in `inspect' | |
from /home/yanoo/.rbenv/versions/1.9.3-p194/bin/irb:12:in `<main>' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Api = ($http) -> | |
{ | |
games: { | |
query: -> | |
$http.get('/games', params: {format: 'json'}) | |
} | |
} | |
angular.module('got').factory('Api', ['$http', Api]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('app').controller 'UserCtrl', ($scope, User) -> | |
$scope.save(user) -> | |
$scope.errors = {} | |
success = -> | |
# do something | |
error = -> | |
angular.forEach result.data.errors, (errors, field) -> | |
$scope.form[field].$setValidity('server', false) | |
$scope.errors[field] = errors.join(', ') # e.g. username is already taken |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# based on http://api.rubyonrails.org/classes/ActionController/RequestForgeryProtection.html | |
module Auth | |
extend ActiveSupport::Concern | |
included do | |
helpers do | |
def session | |
env['rack.session'] | |
end |