Skip to content

Instantly share code, notes, and snippets.

View iorionda's full-sized avatar

Iori ONDA iorionda

  • Freelance
  • Tokyo/Japan
View GitHub Profile
@iorionda
iorionda / file0.txt
Created November 5, 2013 16:31
RubyでHTTPS接続時にSSL証明書のエラーがでる。 ref: http://qiita.com/iori-o@github/items/1babb333e130c8dc70c6
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B`
@iorionda
iorionda / gist:6791269
Created October 2, 2013 09:33
制御コード
x
(when (executable-find "rubocop")
(defun rubocop-after-save-hook()
(shell-command
(format
"/usr/local/var/rbenv/shims/rubocop %s"
(buffer-name(current-buffer))))))
@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$/, '')}"
require 'pdf/reader'
require 'bigdecimal'
def pt2mm(pt)
(pt2inch(pt) * BigDecimal.new("25.4")).round(2)
end
def pt2inch(pt)
(pt / BigDecimal.new("72")).round(2)
end
find . -type f -name '*.rb' -print0 | xargs -0 sed -i '' '/^#.*coding.*[uU][tT][fF]\-8/d'
#!/bin/sh
# An example hook script to verify what is about to be pushed. Called by "git
# push" after it has checked the remote status, but before anything has been
# pushed. If this script exits with a non-zero status nothing will be pushed.
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
@iorionda
iorionda / package-auto-install.el
Created June 13, 2013 05:08
列挙したパッケージを起動時にインストールする
(defvar installing-package-list
'(
;; ここに使っているパッケージを書く。
;; popwin
;; helm
))
(let ((not-installed (loop for x in installing-package-list
when (not (package-installed-p x))
collect x)))
@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
module C
extend ActiveSupport::Concern
module ClassMethods
def c
"c"
end
end
end