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
Test |
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
fizzBuzz max = [fizzBuzzConvert x | x <- [1..max]] | |
fizzBuzzConvert x | |
| x `mod` 15 == 0 = "FizzBuzz" | |
| x `mod` 3 == 0 = "Fizz" | |
| x `mod` 5 == 0 = "Buzz" | |
| otherwise = show x |
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
<tr> | |
<td bgcolor="#FFFFFF" align="right" colspan="2"> | |
<a href="#" onmouseover="activate('login')" onmouseout="inactivate('login')" onclick="submitTheForm('GetPasswordForm','login')"> | |
<img name="login" src="https://support.sagepay.com/GetPassword/images/btnProceed.gif" alt="" border="0" align="right" title="Click here to log into the system"> | |
</a> | |
</td> | |
</tr> |
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 Person < ActiveRecord::Base | |
has_many :friends | |
demeter_mate :friends, :with => :find, :create | |
end | |
# This gives: | |
# :find_friend, :create_friend | |
# as well as the other variations of inflection and order |
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 | |
# The rest of the class ..... | |
def get_object_and_method method_name | |
assoc_methods = [ | |
:push, | |
:concat, | |
:build, |
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 User < ActiveRecord::Base | |
# ... | |
def method_missing method, *args | |
if method.to_s.starts_with? 'find' | |
reading_lists.find *args | |
else | |
super |
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
find . -maxdepth 1 -type d | ruby -pe 'gsub(/^\.\/?/, "")' | grep '.' > /dev/clipboard |
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
function segments(agenda) { | |
return agenda.segments; | |
} | |
function someThingElse(agenda) { | |
var segments = segments(agenda); | |
} |
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
;;segments is a function that takes an agenda and returns its segments | |
(define (segments agenda) (cdr agenda)) | |
;;Then, inside another function: | |
(let ((segments (segments agenda))) | |
;;In this let, segments is the return value of segments. WTF. | |
) | |
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
#This happens after saving src/request.js | |
2011-03-26 14:54:19 Running GetRequestTest,ReadyStateHandlerTest,RequestTest,PostRequestTest | |
Chrome: Runner reset. | |
................ | |
Total 16 tests (Passed: 16; Fails: 0; Errors: 0) (6.00 ms) | |
Chrome 10.0.648.133 Linux: Run 16 tests (Passed: 16; Fails: 0; Errors 0) (6.00 ms) | |
NewerOlder