Skip to content

Instantly share code, notes, and snippets.

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'
@brandoncc
brandoncc / country_and_state_lists.rb
Last active August 29, 2015 14:12
country and state utility actions
# 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
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
<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>
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]
// 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);

Yours

<h5>Comments:</h5>
<% @post.comments.each do |comment| %>
  <div class='well span8'>
    <p>
      <em><%= comment.body %></em>
    </p>