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
// Fix sliders for mobile devices | |
YAHOO.util.Event.onDOMReady(function(){ | |
slider_handles = YAHOO.util.Dom.getElementsByClassName('minthumb'); | |
for(i=0; i<slider_handles.length; i++) { | |
slider_handles[i].addEventListener("touchstart", touchHandler, true); | |
slider_handles[i].addEventListener("touchmove", touchHandler, true); | |
slider_handles[i].addEventListener("touchend", touchHandler, true); | |
slider_handles[i].addEventListener("touchcancel", touchHandler, 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
BlackJack_Procedural ➤ ruby blackjack.rb | |
Hello, Welcome to Lucky Larry's BlackJack....feeling lucky? | |
Player goes first | |
Press [ENTER] | |
-------------------------------------------------- | |
-------------------------------------------------- | |
You drew a J of clubs! | |
-------------------------------------------------- | |
Your score is 10! [ENTER] |
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
<div class="row"> | |
<div class="span0 well text-center"> | |
<% if logged_in? %> | |
<%= link_to vote_post_path(post, vote: true), method: 'post', remote: :true do %> | |
<i class="icon-arrow-up"></i> | |
<% end %> | |
<% end %> | |
<br> | |
<span id="post_<%=post.id%>_votes"><%= post.total_votes %> votes</span> |
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
irb(main):001:0> def doubler(start) | |
irb(main):002:1> puts start | |
irb(main):003:1> end | |
=> nil | |
irb(main):004:0> | |
irb(main):005:0* doubler(2) | |
2 | |
=> nil | |
irb(main):006:0> doubler(4) | |
4 |
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
# requires geonames_api gem | |
# config/initializers/geo_names.rb | |
GeoNamesAPI.username = ENV["GEONAMES_USERNAME"] | |
GeoNamesAPI.lang = :en | |
# utility routes | |
get '/utilities/country_list(.:format)', to: 'utilities#country_list', as: :country_list | |
get '/utilities/state_list/:country(.:format)', to: 'utilities#state_list', as: :state_list |
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
set nocompatible | |
filetype off | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#rc() | |
Plugin 'gmarik/Vundle.vim' | |
Plugin 'tpope/vim-unimpaired' | |
Plugin 'tpope/vim-repeat' |
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
def balance_to_dollars(balance) | |
balance = "#{'%.2f' % balance}" | |
dollars = balance.split('.')[0] | |
cents = balance.split('.')[1] | |
dollars = dollars.reverse.gsub(/...(?=.)/,'\&,').reverse | |
"$#{dollars}.#{cents}" | |
end | |
print "What is your current age? " |
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
// choose a random number which is inclusively between min and max | |
chooseRandomBetween = function(min, max) { | |
var difference = Math.abs(max - min) + 1; | |
return Math.floor(Math.random() * difference) + Math.min(min, max); | |
} |
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
# I wrote this script because I had a bunch of heroku apps on my account that I didn't know what | |
# local apps they matched. Just search the heroku app name and this script will find the local | |
# app for you. | |
# | |
# Feel free to use and alter this script as much as you want. | |
unless ARGV[0] | |
fail 'You pust provide repo name to search for' | |
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
namespace :figaro do | |
desc "SCP transfer figaro configuration to the shared folder" | |
task :setup do | |
on roles(:app) do | |
upload! "config/application.yml", "#{shared_path}/config/application.yml", via: :scp | |
end | |
end | |
desc "Symlink application.yml to the release path" | |
task :symlink do |
OlderNewer