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
# routes.rb | |
# You can do this: | |
map.connect '/something/*email', :controller => 'something', :action=> 'some_action' | |
# ...to get the email parameter as an array. | |
# Then you can do this in your controller: | |
# something_controller.rb | |
email_address = params[:email][0] |
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
Anders-Norass-MacBook-Pro:.ssh anders$ which pbcopy | |
/usr/bin/pbcopy | |
Anders-Norass-MacBook-Pro:.ssh anders$ cat id_rsa.pub | pbcopy | |
-bash: pbcopy: command not found | |
Anders-Norass-MacBook-Pro:.ssh anders$ |
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
<!doctype html> | |
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-latest.min.js"></script> | |
<script src="client/socket.io.js" type="text/javascript" charset="utf-8"></script> | |
<script type="text/javascript" charset="utf-8"> | |
var socket = new io.Socket(null, {rememberTransport: false, port: 8080}); | |
socket.connect(); | |
socket.addEvent('message', function(data) { | |
$('body').append('<p>' + $.map(data, function(e,i) { |
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
Object.prototype.inherits = function(base, args) { | |
if (arguments.length > 1) { | |
base.apply(this, Array.prototype.slice.call(arguments, 1)); | |
} else { | |
base.call(this); | |
} | |
}; | |
Function.prototype.inherits = function(base){ | |
this.prototype = new base(); |
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
# It's been a while since I've written code like this :-) | |
def encoding_error_fucks_up_html_length?(node) | |
# Are we experiencing this Nokogiri issue: http://github.com/tenderlove/nokogiri/issues/#issue/215 | |
node.inner_html.length < node.inner_text.length | |
end |
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
module Paperclip | |
class << self | |
def logger #:nodoc: | |
# Paperclip depends on having a logger available, so let's create a nice fallback chain... | |
MongoMapper.logger || Rails.logger || Logger.new(STDOUT) | |
end | |
end | |
module ClassMethods | |
def has_attached_file name, options = {} |
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
snehvit:~ anders$ gem install toto | |
Building native extensions. This could take a while... | |
Successfully installed rdiscount-1.6.5 | |
Successfully installed toto-0.4.6 | |
2 gems installed | |
Installing ri documentation for rdiscount-1.6.5... | |
Installing ri documentation for toto-0.4.6... | |
Installing RDoc documentation for rdiscount-1.6.5... | |
Installing RDoc documentation for toto-0.4.6... | |
snehvit:~ anders$ ruby -v |
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.prototype.memoize = function() { | |
var fn=this; | |
var args = Array.prototype.slice.call(arguments); | |
var target = args.length > 0 ? args[0] : null; | |
fn._vals = fn._vals || {}; | |
return function() { | |
var call_args = Array.prototype.slice.call(arguments); | |
if (fn._vals[call_args] !== undefined) return fn._vals[call_args]; | |
fn._vals[call_args] = fn.apply(target, arguments); | |
return fn._vals[call_args]; |
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
Del Close & John Brent - Basic Hip | |
Reuben Bell - Superjock | |
Archaeopterix - Samstag Abend, Sonntag Morgen | |
Les Maledictus Sound - Kriminal Theme | |
Joe Cogra Group - Darkness | |
Googoosh - Talagh | |
Lord Cobra Y Los Hnos. Duncan - Love Letters | |
Lonnie Mack - Too Much Trouble | |
Boobpa Saichol - Seng Rabird | |
Colosseum - The Kettle |
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
puts %q( | |
/***** | |
* This is a test program with 5 lines of code | |
* \/* no nesting allowed! | |
//*****//***/// Slightly pathological comment ending... | |
public class Hello { | |
public static final void main(String [] args) { // gotta love Java | |
// Say hello | |
System./*wait*/out./*for*/println/*it*/("Hello/*"); | |
} |
OlderNewer