Skip to content

Instantly share code, notes, and snippets.

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)
<!doctype html>
<html>
<head>
<title>RSS Feed Viewer</title>
</head>
<body>
<h2>Hi there!</h2>
<p><%= open_rss.channel.title %></p>
</body>
</html>
# Make sure that Node is %script{src'd} before Sprite
window.Node: class Node
addToStage: ->
console.log "Add node to stage"
<!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">
@chrislloyd
chrislloyd / prime.rb
Created November 19, 2009 00:52 — forked from atnan/prime.rb
class Integer
def prime?
("1" * self).match(/^1?$|^(11+?)\1+$/).nil?
end
end
// global set by server
COMMENTS = [{
'title': 'hello',
'body': 'im a lonley comment'
}];
// template & controller codez together as friends
html5(function(html) {
html.import('jquery');
0,128,128,544,128,1040,128,672,320,49284,33088,544,128,144,0,128
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
@chrislloyd
chrislloyd / gist:70644
Created February 26, 2009 03:56 — forked from lachie/gist:70629
def f(ra,n)
ra.select {|x| x.include? n}.size
end
@chrislloyd
chrislloyd / page.rb
Created February 16, 2009 02:06 — forked from xaviershay/page.rb
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'