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 | |
if ARGV.size != 2 | |
puts "Usage: #{$0} <from_language> <to_language>" | |
exit -1 | |
end | |
require 'rubygems' | |
require 'ya2yaml' # this gem is needed for this to work! | |
require 'yaml' |
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
module ClassAttributeMixin | |
def self.included(base) | |
class << base | |
def attr_accessor(*splash) | |
@attributes ||= [] | |
@attributes.concat splash | |
super | |
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
# First the end result of what we want: | |
class Foo | |
before_hook :whoa | |
before_hook :amazing | |
def test | |
puts "This is kinda cool!" | |
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
OK, Let's begin. Hello, Everybody. | |
My name is Narihiro Nakamura. | |
Today, I'm talking about "Parallel worlds of CRuby's GC". | |
I'm very happy now, because I'm meeting attendee in rubyconf. | |
And, one of my dreams is to talk in rubyconf. | |
So, I'm very happy and exciting. | |
Today is my first presentation in English. | |
My English is not good. |
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
# DOCKER-VERSION 0.4.8 | |
# am facing issue | |
# https://github.com/dotcloud/docker/issues/1123 | |
FROM ubuntu:12.04 | |
MAINTAINER Deepak Kannan "[email protected]" | |
RUN apt-get -y install python-software-properties |
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 | |
# Please read http://otobrglez.opalab.com for more information about this code. | |
class Book < Struct.new(:title) | |
def words | |
@words ||= self.title.gsub(/[a-zA-Z]{3,}/).map(&:downcase).uniq.sort | |
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
#Extended this gist https://gist.github.com/knapo/8897592 | |
class ActiveRecord::Base | |
def self.has_many_documents(association_name) | |
class_eval %< | |
def #{association_name} | |
#{association_name.to_s.singularize.classify}.where(#{name.underscore}_id: id) | |
end | |
> | |
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
is_weekday = lambda {|day_of_week, time| time.wday == day_of_week}.curry | |
sunday = is_weekday[0] | |
monday = is_weekday[1] | |
tuesday = is_weekday[2] | |
wednesday = is_weekday[3] | |
thursday = is_weekday[4] | |
friday = is_weekday[5] | |
saturday = is_weekday[6] |
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
module Util | |
# Create Job class from ENV string | |
def self.create_job_class(name, queue_var) | |
klass = Class.new(ActiveJob::Base) do | |
queue_as ENV.fetch(queue_var, 'default') | |
end | |
create_dynamic_class(name, klass) | |
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
-- show running queries (pre 9.2) | |
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(query_start, clock_timestamp()), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
OlderNewer