🤹♂️
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
/* | |
TrafficCop | |
Author: Jim Cowart | |
License: Dual licensed MIT (http://www.opensource.org/licenses/mit-license) & GPL (http://www.opensource.org/licenses/gpl-license) | |
Version 0.1.0 | |
*/ | |
(function($, undefined) { | |
var inProgress = {}; |
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
class Array | |
def pluck key | |
map { |hash| hash[key] } | |
end | |
end | |
[{:number => "1"}, {:number => "2"}, {:number => "3"}].pluck(:number) | |
# => ["1", "2", "3"] |
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
gem 'chronic_duration' |
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
class ExampleClient | |
include HTTParty | |
extend HTTPExceptions | |
parser Class.new HTTParty::Parser | |
parser.send :include, PresentParser | |
parser.send :include, MashedParser | |
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
require 'httparty' | |
# This may go away: | |
require 'active_support/all' | |
# (doesn't *require* Rails, but adds some niceties) | |
module Chargify | |
VERSION = "0.0.1".freeze | |
# Create a default `Client`, attempting to use Rails application config. | |
def self.client options=nil |
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
= semantic_form_for @my_model do |f| | |
= f.inputs do | |
= f.input :interval_duration | |
= f.buttons |
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
#!/usr/bin/env ruby -rubygems -ractive_support/all | |
# The one everyone writes | |
(1..100).each do |number| | |
if number % 15 == 0 | |
puts "FizzBuzz" | |
elsif number % 3 == 0 | |
puts "Fizz" | |
elsif number % 5 == 0 | |
puts "Buzz" |
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
# Window quit key binding | |
((ViMap normalMap) map:"<ctrl-w><ctrl-q>" to:"<esc>:quit<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
(function ($) { | |
formatDuration = function(seconds) { | |
var duration = '', | |
days = Math.floor(seconds / 86400), | |
hours = Math.floor(seconds / 3600) % 24, | |
minutes = Math.floor(seconds / 60) % 60, | |
seconds = seconds % 60; | |
if (days) | |
duration = days + ' day' + (days > 1 ? 's' : '') + ', '; |
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
$ rake routes | |
security_foo GET /security(.:format) {:controller=>"security", :action=>"foo"} |