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
Java のコードを | |
pythonista に持ち込む:まぁ、Java も書けなくはないけどね | |
rubyist に持ち込む:ツマラン、どこかに細工してやろうか・・・ | |
perler に持ち込む:出てけゴルァァァァァァァァァァァ!! | |
Python のコードを | |
Java エンジニアに持ち込む:おぅ、Python のコードか | |
rubyist に持ち込む:スクリプト言語の僚友だ、バッチリ直してやるぜ | |
perler に持ち込む:けっ、優等生か |
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 'stringio' | |
require 'timeout' | |
class Object | |
def methods_returning(expected, *args, &blk) | |
old_stdout = $> | |
$> = StringIO.new | |
methods.select do |meth| | |
Timeout::timeout(1) { dup.public_send(meth, *args, &blk) == expected rescue false } rescue false |
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
import sublime, sublime_plugin | |
import os | |
class AroundFilesCommand(sublime_plugin.TextCommand): | |
def run(self, edit): | |
dirname = os.path.dirname(self.view.file_name()) | |
self.around_file(dirname) | |
def around_file(self, dirname): | |
files = os.listdir(dirname) |
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
def capture(options={}) | |
out = options[:out] | |
err = options[:err] || :out | |
stdout_old = $stdout.dup | |
stderr_old = $stderr.dup | |
$stdout.reopen out | |
err = $stdout if err == :out |
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 | |
require 'rubygems' | |
require 'redcarpet' | |
require 'pygments.rb' | |
class HTMLwithPygments < Redcarpet::Render::HTML | |
def block_code(code, language) | |
Pygments.highlight(code, :lexer => language.to_sym, :options => { | |
:encoding => 'utf-8' | |
}) |
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
load 'deploy/assets' | |
namespace :deploy do | |
namespace :assets do | |
desc 'Run the precompile task locally and rsync with shared' | |
task :precompile, :roles => :web, :except => { :no_release => true } do | |
%x{bundle exec rake assets:precompile} | |
%x{rsync --recursive --times --rsh=ssh --compress --human-readable --progress public/assets #{user}@#{host}:#{shared_path}} | |
%x{bundle exec rake assets:clean} | |
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
# config/initializers/will_paginate.rb | |
module WillPaginate | |
module ActionView | |
def will_paginate(collection = nil, options = {}) | |
options[:renderer] ||= BootstrapLinkRenderer | |
super.try :html_safe | |
end | |
class BootstrapLinkRenderer < LinkRenderer |
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
/* | |
Some simple Github-like styles, with syntax highlighting CSS via Pygments. | |
*/ | |
body{ | |
font-family: helvetica, arial, freesans, clean, sans-serif; | |
color: #333; | |
background-color: #fff; | |
border: none; | |
line-height: 1.5; | |
margin: 2em 3em; |
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
# Add this to the end of your development.rb and add | |
# | |
# gem 'pry' | |
# | |
# to your Gemfile and run bundle to install. | |
silence_warnings do | |
begin | |
require 'pry' | |
IRB = Pry |
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
ja: | |
errors: | |
messages: | |
not_found: "は見つかりませんでした" | |
# not_found: "not found" | |
already_confirmed: "は既に登録済みです" | |
# already_confirmed: "was already confirmed" | |
not_locked: "は凍結されていません" | |
# not_locked: "was not locked" |
NewerOlder