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 pluralize_bottle(num);if num == 1;"#{num} bottle";else;"#{num} bottles";end;end;x = 99;while(x > 0) do; puts("#{pluralize_bottle(x)} of beer on the wall!"); sleep(1); puts("#{pluralize_bottle(x)} of beer!"); sleep(1); puts("You take one down..."); sleep(1); puts("Pass it around..."); sleep(1); x-=1; puts "#{pluralize_bottle(x)} of beer on the wall!";sleep(2);if(x==0);puts("No more bottles of beer on the wall, no more bottles of beer. Go to the store and buy some more, 99 bottles of beer on the wall.");4.times do;sleep(2);puts("...");sleep(2);end;x=99;else;puts("...");end;sleep(2);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
def nav_parent(options = {}, &block) | |
content_tag :ul, capture(&block), options | |
end | |
def nav_link_to(name, route, options = {}, &block) | |
options[:class] ||= "active" if current_page?(route) || request.env["PATH_INFO"].starts_with?(route) | |
content_tag :li, (link_to(name, route) + (content_tag(:ul, capture(&block)) if block_given?)), options | |
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
// Array.matches: find all matches between two arrays | |
// usage: arr1.matches(arr2); | |
Array.prototype.matches=function(a){var m=[];for(i=0;i<this.length;i++){if(a.indexOf(this[i])>-1){m.push(this[i])}}return m;} | |
// jQuery.collectValues: collect all values in selected inputs | |
// usage: $('input, textarea').collectValues(); | |
jQuery.prototype.collectValues=function(){var a=[];this.each(function(){a.push($(this).val())});return a;} |
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
<?php | |
function twitter ( $username, $file = 'twitter.xml', $interval = 600 ) { | |
$url = 'https://api.twitter.com/1/statuses/user_timeline/' . $username . '.xml?count=3'; | |
if ( ( is_file ( $file ) && ( time () - filemtime ( $file ) ) > $interval ) || filesize ( $file ) == 0 ) { | |
$curl = curl_init(); | |
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 1 ); | |
curl_setopt ( $curl, CURLOPT_URL, $url ); |
NewerOlder