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
require 'fileutils' | |
require 'rubygems' | |
require 'titleize' | |
def is_artist_folder?(path) | |
Dir.glob(File.join(path, "*")).any? { |contained_file| File.directory?(contained_file) } | |
end | |
def get_artist_name(path) |
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
<!doctype html> | |
<html> | |
<head> | |
<title>RSS Feed Viewer</title> | |
</head> | |
<body> | |
<h2>Hi there!</h2> | |
<p><%= open_rss.channel.title %></p> | |
</body> | |
</html> |
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 sure that Node is %script{src'd} before Sprite | |
window.Node: class Node | |
addToStage: -> | |
console.log "Add node to stage" |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
<title>sketch</title> | |
<style type="text/css" media="screen"> |
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 Integer | |
def prime? | |
("1" * self).match(/^1?$|^(11+?)\1+$/).nil? | |
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
// global set by server | |
COMMENTS = [{ | |
'title': 'hello', | |
'body': 'im a lonley comment' | |
}]; | |
// template & controller codez together as friends | |
html5(function(html) { | |
html.import('jquery'); |
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
0,128,128,544,128,1040,128,672,320,49284,33088,544,128,144,0,128 |
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
Registration.find_all_by_complete(true).each_with_object({}) do |reg, count| | |
date = reg.sydney_updated_at.to_date | |
count[date] ||= 0 | |
count[date] += 1 | |
end | |
registration_count.inspect |
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
def f(ra,n) | |
ra.select {|x| x.include? n}.size | |
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
Refactor this code: URL Matching Edition | |
-- | |
So I have Pages, in a nested set so that each page has parent. That allows me to have urls like: | |
/foo/bar | |
where the Page with permalink 'foo' has a child with the permalink 'bar'. In my routes.rb I have a general catch-all route as my last route. | |
map.page '/*tree', :controller => 'pages', :action => 'show' |
NewerOlder