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
[59] pry(main)> Date.parse("22-07-2013").to_time | |
=> 2013-07-22 00:00:00 +0200 | |
[60] pry(main)> Date.parse("22-07-2013").to_time.utc | |
=> 2013-07-21 22:00:00 UTC | |
vs | |
[61] pry(main)> Date.parse("22-07-2013").to_datetime |
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
source 'https://rubygems.org' | |
source 'http://rails-assets.org' | |
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | |
gem 'rails', '4.0.0' | |
# Use sqlite3 as the database for Active Record | |
gem 'sqlite3' | |
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
#!/bin/sh | |
# Usage | |
# $ cat Gemfile.lock | hipchat | |
# $ rake middleware 2>&1 | hipchat | |
curl -XPOST "http://api.hipchat.com/v1/rooms/message?format=json&auth_token=TOKEN" -d "room_id=ROOM&from=zsh&message_format=text&message=/code%20$(cat)" |
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
require "tempfile" | |
require "bundler/cli" | |
require 'benchmark' | |
def run | |
$stdout = StringIO.new; | |
10.times do | |
Dir.mktmpdir do |dir| | |
yield(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
function loc { | |
s=$(git stash) | |
localeapp pull && git commit -am "Pulled new translations from localeapp" | |
if [ ! "$s" = "No local changes to save" ]; then git stash pop; fi | |
} |
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
# Gemfile | |
gem "logstasher" | |
# production.rb | |
config.logstasher.enabled = true | |
# config/initializers/logstash.rb | |
$logstasher_redis = Redis.new(:port => 9002) |
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
~ λ irb -r logger -r awesome_print -r yell | |
irb(main):001:0> Yell::Logger.send(:include, AwesomePrint::Logger) | |
=> Yell::Logger | |
irb(main):002:0> Yell::Logger.new(STDOUT).ap [1,2,3] | |
2013-06-05T17:15:35+02:00 [DEBUG] 27891 : [ | |
[0] 1, | |
[1] 2, | |
[2] 3 | |
] | |
=> true |
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
# gem "ruby-prof" | |
around_filter :profiler | |
def profiler(&block) | |
data = RubyProf::Profile.profile(&block) | |
filepath = Rails.root.join("tmp", "profiler.html") | |
File.open(filepath, "w") do |f| | |
RubyProf::CallStackPrinter.new(data).print(f) |
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 A | |
class B extends A | |
class C extends B | |
class Foo[X] { | |
def x[T >: X] = 1 | |
def y[T <: X] = 2 | |
} | |
val foo = new Foo[B] |
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
https://github.com/RyanScottLewis/jquery-cookie-rails | |
https://github.com/kclair/jquery-fancybox-rails | |
https://github.com/seamusabshere/jquery-mousewheel-rails |