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 < ActiveRecord::Base | |
after_save { push_updates if changed? } | |
private | |
def push_updates | |
if self.my_attribute_changed? | |
Pusher["channel-example"].trigger!("my-attribute-update", {:my_attribute => self.my_attribute}) | |
end |
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 MailingList < ActiveRecord::Base | |
has_many :subscribers | |
def self.instance | |
self.find_by_id(1) | |
end | |
end |
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 MailingList < ActiveRecord::Base | |
has_many :subscribers | |
before_create :assert_singleton! | |
def self.instance | |
first || create! | |
end | |
private |
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
#!/bin/bash | |
echo "Installing Kids Ruby!" | |
sudo apt-get install git | |
# rbenv | |
cd | |
git clone git://github.com/sstephenson/rbenv.git .rbenv | |
echo `export PATH="$HOME/.rbenv/bin:$PATH"` >> ~/.bash_profile | |
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile |
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
make[1]: Entering directory `/home/patrickgombert/.cpputest/examples' | |
compiling MockDocumentationTest.cpp | |
ApplicationLib/MockDocumentationTest.cpp: In member function ‘virtual void TEST_MockDocumentation_returnValue_Test::testBody()’: | |
ApplicationLib/MockDocumentationTest.cpp:132:6: error: variable ‘value’ set but not used [-Werror=unused-but-set-variable] | |
cc1plus: all warnings being treated as errors | |
make[1]: *** [objs/ApplicationLib/MockDocumentationTest.o] Error 1 | |
make[1]: Leaving directory `/home/patrickgombert/.cpputest/examples' | |
make: *** [examples] Error 2 |
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
var hider = function() { | |
$("#some_div").hide(); | |
} | |
var shower = function() { | |
$("#some_div").show(); | |
} | |
var total_column = function() { | |
var total = 0; |
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
var Visibility { | |
init : function() { | |
$("#some_button").bind('click', hider); | |
$("#some_other_button").bind('click', shower); | |
} | |
hider : function() { | |
$("#some_div").hide(); | |
} |
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
; Here is our protocol | |
(defprotocol ThirdGradeMath | |
(add [this]) | |
(sub [this]) | |
(mul [this]) | |
(div [this])) | |
;And our record | |
(defrecord MathRecord [x y] | |
;Let's implement our protocol |
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
(ns test.wrapper | |
(:gen-class | |
:name test.Speak | |
:methods [ | |
[hello [String] String] | |
])) | |
(defn -hello [this name] | |
(str "Hello, " name)) |
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
(ns test.wrapper | |
(:gen-class | |
:name test.Speak | |
:state name | |
:methods [ | |
[hello [] String] | |
[setName [name] void] | |
])) | |
(defn -setName[this name] |
OlderNewer