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
/ HAML's syntax sucks for HTML5 data attrs when used as extensively | |
/ as they currently are by trendy JS frameworks. | |
#content{ :'data-role' => 'application' } | |
#header | |
ul.navigation{ :'data-role' => :toolbar } | |
li.navigation{ :'data-transition' => :fade } Link 1 | |
li.navigation{ :'data-transition' => :bounce } Link 2 | |
#main{ :'data-role' => :window } | |
Hello World |
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
.content-primary | |
%form{:action => "#", :method => "get"} | |
%h2 Form elements | |
%p This page contains various progressive-enhancement driven form controls. Native elements are sometimes hidden from view, but their values are maintained so the form can be submitted normally. | |
%p Browsers that don't support the custom controls will still deliver a usable experience, because all are based on native form elements. | |
.ui-field-contain.ui-body.ui-br{"data-role" => "fieldcontain"} | |
%label.ui-input-text{:for => "name"} Text Input: | |
%input#name.ui-input-text.ui-body-null.ui-corner-all.ui-shadow-inset.ui-body-c{:name => "name", :type => "text", :value => ""}/ | |
.ui-field-contain.ui-body.ui-br{"data-role" => "fieldcontain"} | |
%label.ui-input-text{:for => "textarea"} Textarea: |
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
master [logankoester-agora::mlg-tv@17:05:34]>bundle list | grep errship | |
* errship (0.3.0 397d2f5) | |
master [logankoester-agora::mlg-tv@17:04:26]>ruby -r errship | |
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- errship (LoadError) | |
from <internal:lib/rubygems/custom_require>:29:in `require' | |
master [logankoester-agora::mlg-tv@17:05:13]>ruby -r rails -e "" | |
master [logankoester-agora::mlg-tv@17:05:47]> |
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
namespace :bundler do | |
task :install, :roles => :app, :except => { :no_release => true } do | |
run("gem install bundler --source=http://rubygems.org") | |
end | |
task :create_symlink, :roles => :app do | |
shared_dir = File.join(shared_path, 'bundle') | |
release_dir = File.join(current_release, '.bundle') | |
run("mkdir -p #{shared_dir} && ln -fs #{shared_dir} #{release_dir}") | |
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
# ... | |
namespace :bundler do | |
task :create_symlink, :roles => :app do | |
shared_dir = File.join(shared_path, 'bundle') | |
release_dir = File.join(current_release, '.bundle') | |
run("mkdir -p #{shared_dir} && ln -s #{shared_dir} #{release_dir}") | |
end | |
task :bundle_new_release, :roles => :app do |
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
<script type="text/javascript" src="js/bgrotate.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$('#bgcontainer').bgrotate({ | |
delay: 2, | |
speed: 'fast', | |
url: 'images/images.txt' | |
}); | |
}); | |
</script> |
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
An apple and a berry plant, | |
Comes with a house. | |
On the grass - who is that, | |
Who comes by my house? | |
Stands outside my window, | |
Sucking on the berries and | |
Eats us out of house and home. | |
Keeping us awake... | |
Keeping us awake. |
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 Hash | |
def to_html_attrs | |
# Useful for implementing the html_options hash argument on non-rails erb helpers | |
attrs = Array.new | |
self.each_pair {|k,v| attrs.push "#{k}=\"#{v}\""} | |
return attrs.join " " | |
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
User.each do |user| | |
user.friends.each do |friend| | |
t = Twitter::Client.new(:login => user.screen_name, :password => user.password) | |
t.defriend(friend.friend_id) | |
friend.destroy | |
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
module Enumerable | |
# Return elements after the first x | |
def enum_after(x) | |
a = 0 | |
self.partition{ a += 1; a < (x + 1) }.last | |
end | |
# Return elements with keys between x and y | |
def enum_between(x,y) | |
self.reject{|(k,v)| k < (x + 1) || (y - 1) < k } |