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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" | |
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> | |
<head> | |
<title>Navigator.plugins</title> | |
</head> | |
<body> | |
<script type="text/javascript" charset="utf-8"> |
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 Sub | |
def name_please | |
self.class.name | |
end | |
end | |
class Super < Sub | |
end | |
super_man = Super.new |
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
arr = [{:a => 1}, {:a => 2}, {:a => 3}, {:a => 4}, {:b => 3}, {:b => 4}, {:a => 5}] | |
# I want to get ... | |
# | |
# [ | |
# {:a => [1,2,3,4]}, | |
# {:b=> [3,4]}, | |
# {:a => [5]} | |
# ] |
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
<html> | |
<head> | |
<link rel="alternate" type="application/json+oembed" href="http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3DGvxCi06sc2I&format=json" title="Dancing Girls! (10-16-09 Vlog #5)" /> | |
<link rel="alternate" type="text/xml+oembed" href="http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3DGvxCi06sc2I&format=xml" title="Dancing Girls! (10-16-09 Vlog #5)" /> | |
[...] | |
</head> | |
<body> | |
[...] | |
</body> | |
</html> |
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
/* Polls the server for new JSON data at a defined interval. Requests are garunteed to not stack up on each other. | |
Example Usage: | |
var poller = $.poller({ | |
url: function(head){ | |
var base = '/messages/'; | |
return (head) ? (base + '?since_id=' + head.result.id) : base; | |
}, | |
receive: function(set){ |
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
# A hacky way to put files in Capistrano with sudoer permissions | |
def sudo_put(data, target) | |
tmp = "#{shared_path}/~tmp-#{rand(9999999)}" | |
put data, tmp | |
on_rollback { run "rm #{tmp}" } | |
sudo "cp -f #{tmp} #{target} && rm #{tmp}" | |
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
ActiveRecord::Base.connection.execute %{ | |
UPDATE memberships, accounts | |
SET memberships.is_owner = true | |
WHERE memberships.user_id = accounts.owner_id AND memberships.is_user = true | |
} |
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
%{Hey I'm a string} | |
%(Hey I'm another string) | |
%[Hey its me, yep... another string!] |
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
ActiveRecord::Base.connection.execute <<-SQL | |
UPDATE memberships, accounts | |
SET memberships.is_owner = true | |
WHERE memberships.user_id = accounts.owner_id AND memberships.is_user = true | |
SQL |
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
# Creates an array out of the words in a string | |
>> %w[one two three] | |
=> ["one", "two", "three"] | |
# Executes a system command and captures the output as a string | |
>> %x[ls] | |
=> "Applications\nDesktop\nDocuments\nDownloads\nDropbox\nLibrary\nMovies\nMusic\nPictures\nProjects\nPublic\nSites\nVirtual Machines\npe\n" | |
# Creates a regexp object | |
>> %r{(\w+)\.html} |
OlderNewer