This file contains 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
// Prototype toQueryString fix | |
(function(){ | |
'use strict'; | |
function typeOf(obj) { | |
if (obj instanceof Date) { | |
return 'date'; | |
} else if (Object.isArray(obj)) { | |
return 'array'; |
This file contains 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
/* | |
Prototype's helper for quick and easy observing | |
click events on different elements including | |
anchors with '#' href | |
Usage examples: | |
instead of: |
This file contains 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
run 'rm public/index.html' | |
run 'rm public/favicon.ico' | |
run 'rm public/images/rails.png' | |
# remove Prototype defaults | |
run 'rm public/javascripts/controls.js' | |
run 'rm public/javascripts/dragdrop.js' | |
run 'rm public/javascripts/effects.js' | |
run 'rm public/javascripts/prototype.js' |
This file contains 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
# doesn't fucking work | |
class Logo < ActiveRecord::Base | |
state_machine :state, :initial => :initial do | |
# here vvv | |
after_transition :initial => :used, :do => :test_callback |
This file contains 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
// тупо | |
var wiget = new Class({ | |
// ... | |
getSomething: function(){ | |
if (this.something) return this.something; | |
this.something = new Element('div'); | |
// тут километры кода | |
return this.something; |
This file contains 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
!function(){ | |
function fakeLength(fn, length) { | |
if (length == fn.length) return fn; | |
var fakeArgs = []; | |
while(length--) fakeArgs.push('$fakeArg'+length); | |
return eval('(function('+fakeArgs.join(',')+'){ return fn.apply(this, arguments); })'); | |
} | |
Function.prototype.allRequired = function(){ |
This file contains 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 Authentication < ActiveRecord::Base | |
belongs_to :user | |
serialize :info | |
serialize :credentials | |
def update_from_omniauth(omniauth) | |
self.uid = omniauth['uid'] | |
self.provider = omniauth['provider'] | |
self.info = omniauth['user_info'] | |
self.credentials = omniauth['credentials'] |
This file contains 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
my_object.bool_method?? 'yes' : 'no' | |
# or | |
my_object.bool_method? ? 'yes' : 'no' | |
# or | |
(my_object.bool_method?) ? 'yes' : 'no' |
This file contains 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
= extends :html5_base do | |
- append :head do | |
meta(http-equiv="X-UA-Compatible" content="IE=edge") | |
title Lolwut | |
= area :assets do | |
= javascript_include_tag 'application' | |
= yield | |
#fb-root |
This file contains 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
# Expected h1 title for posts#show is "My Blog :: My Post Title" | |
# -------------------------------------------------------------- | |
# This was how it worked with `layout nil` in the controller | |
# | |
# posts_controller.rb | |
class PostsController | |
layout nil |
OlderNewer