Skip to content

Instantly share code, notes, and snippets.

View iorionda's full-sized avatar

Iori ONDA iorionda

  • Freelance
  • Tokyo/Japan
View GitHub Profile
require 'active_support'
require 'active_support/core_ext/object/to_query'
require 'active_support/core_ext/string/strip'
params = {
title: '問題を一言で',
labels: %w(bug),
body: <<-EOS.strip_heredoc
## 出す前に確認しよう
@geemus
geemus / Gemfile
Created November 22, 2010 22:45
fog - resume uploading example
source "http://rubygems.org"
gem 'fog'
@jugyo
jugyo / to_factory_girl.rb
Created November 7, 2012 05:54
ActiveRecord extension to print FactoryGirl definition!
class ActiveRecord::Base
# Usage:
#
# > puts User.first.to_factory_girl
# FactoryGirl.define do
# factory :user do
# ...
# end
# end
# # Usage: FactoryGirl.create(:user, ...)
#!/usr/bin/env ruby
require 'optparse'
opts = OptionParser.new
opts.on('--noop', 'dry-run mode') { |v| $noop = true }
opts.parse!
`git branch -r`.each_line do |branch|
branch.strip!.chomp!
next if branch =~ %r![^/]+/master!
@moro
moro / gist:5596366
Created May 17, 2013 01:34
retriable
module Retriable
class RepeatedError < RuntimeError
def initialize(max, *args)
@errors = []
@max = max
super(*args)
end
def <<(e)
@errors << e
@iorionda
iorionda / pre-commit.debugprint.rb
Created June 12, 2013 05:01
debug print ががが... #というわけで #たまには使ってね
#!/usr/bin/env ruby
class String
def colorize(color_code)
"\e[#{color_code}m#{self}\e[0m"
end
def red ; colorize(31) ; end
def green ; colorize(32) ; end
def yellow ; colorize(33) ; end
def pink ; colorize(35) ; end
@iorionda
iorionda / to_factory_girl.rb
Created August 20, 2013 01:56
rails console で 3.2.11@1.9.3-p392(main)> model.first.to_fg
class ActiveRecord::Base
def to_factory_girl
ignores = %w(id created_at updated_at)
array = []
array << "FactoryGirl.define do"
array << " factory :#{self.class.model_name.underscore} do"
attributes.each do |key, value|
next if ignores.include?(key)
if key =~ /_id$/
array << " association :#{key.gsub(/_id$/, '')}"

Thinking in Erlang

One day Erlang training.

Goals

This training should get you started with Erlang and understand how to design a highly available distributed system. Because there is only one day, we focus on the essential concepts and skip over many details that would be covered in the normal three days course.

@shyouhei
shyouhei / gist:0b7dab3e75bfbf96f895
Created March 31, 2015 15:26
新社会人の人が留意すべき事項

新社会人に必須である:

  • 勤務先との書面による「労働契約」。業務委託契約等NG。
  • 多寡を問わず毎月払われる給料。遅配等論外である。
  • 健康保険。
  • 労災保険。
  • 雇用保険。
  • 三六協定。
  • 年次有休。
  • 育児休業の制度があり取得者がいる会社に勤務する。
@LeCoupa
LeCoupa / casperjs.cheatsheet.js
Last active January 23, 2022 07:56
Cheatsheet: CasperJS, PhantomJS & Spooky --> https://github.com/LeCoupa/awesome-cheatsheets
// PhantomJS Cheatsheet
$ brew update && brew install phantomjs // install PhantomJS with brew
phantom.exit();
var page = require('webpage').create();
page.open('http://example.com', function() {});
page.evaluate(function() { return document.title; });