Skip to content

Instantly share code, notes, and snippets.

@rochefort
rochefort / capistrano_sample_thinking_sphinx_deploy.rb
Created September 9, 2010 16:45
capistrano_sample_thinking_sphinx_deploy.rb
set :application, "<app_name>"
set :scm, :git
set :repository, "<repository_path>"
set :branch, 'master'
set :deploy_via, :copy
set :deploy_to, "<app_path>/#{application}"
set :use_sudo, false
set :rails_env, "production"
set :user, '<ssh_user>'
@rochefort
rochefort / gm_display_real_image_size.js
Created October 28, 2010 14:03
(gm)display real image size
// ==UserScript==
// @name display real image size
// @namespace http://www.rochefort8.com/
// @include *
// ==/UserScript==
(function(){
var imgs, img;
imgs = xpath('//img');
if(!imgs.snapshotLength) return;
for(var i = 0; i < imgs.snapshotLength; i++){
@rochefort
rochefort / remove_buzzword_from_itunes_lyric.rb
Created October 29, 2010 10:05
remove_buzzword_from_itunes_lyric
#! /usr/bin/env ruby
begin require 'rubygems'; rescue LoadError; end
$KCODE = "UTF8"
require 'rbosa'
OSA.utf8_strings = true
itunes = OSA.app('iTunes')
plist = itunes.current_playlist
pl_Array = plist.tracks()
@rochefort
rochefort / _open.vbs
Last active November 15, 2016 09:22
_open.vbs
Option Explicit
Dim WShell, oExec
Set WShell = WScript.CreateObject("WScript.Shell")
Dim openPath, numArgs, argPath
Dim exe
exe = "explorer /root,"
'exe = "C:\opt\apl\mdie0300RC6\MDIE.exe"
'exe = "C:\opt\apl\xf11-7\XF.exe"
numArgs = WScript.Arguments.Count
'[.][./]は引数無しと一緒(カレントパス)
class Majang
def mati(haipai)
@tenpai = []
mati_check(haipai.split(//).sort)
@tenpai.uniq!
@tenpai.each{|x| puts x}
end
private
def append_tenpai(mentu, mati)
require File.expand_path(File.dirname(__FILE__) + '/../majang.rb')
describe Majang do
before do
@m = Majang.new
end
describe "待ち無し1112224788899" do
before { @m.mati("1112224788899") }
subject { @m.tenpai}
#!/usr/bin/env ruby -Ku
require 'rubygems'
require 'mechanize'
require 'pp'
URL = "http://www.dmm.com/akb48/-/akb48member/"
module AKB48
class Scrape
attr_reader :team_a, :team_k, :team_b, :team_r
def initialize
@rochefort
rochefort / kill_rails.vbs
Created March 19, 2011 08:36
kill the rails process for windows
Option Explicit
Call Kill_Rails
Sub Kill_Rails
Dim objService, objProcesses
Dim proc
Dim query
query = "SELECT * FROM Win32_Process Where Name = 'ruby.exe' And CommandLine = 'ruby script\\server'"
Set objservice = GetObject("winmgmts:")
Set objProcesses = objService.ExecQuery(query)
@rochefort
rochefort / tree.rb
Created May 22, 2011 05:15
The array of the relationship between a child and his parents is output by the hierarchical display.
#!/usr/bin/env ruby
class Tree
def initialize
@data = Array.new
end
def <<(ary)
@data << ary
end
@rochefort
rochefort / gist:1028328
Created June 15, 2011 22:53
official_notification.rb
require 'rubygems'
require 'net/http'
require 'json'
url = 'search.twitter.com'
path = '/search.json?q=人事異動&locale=ja&rpp=100'
Net::HTTP.start(url) do |http|
json = JSON.parse(http.get(path).body)
puts json['results'].map{ |r| "#{r['from_user']}: #{r['text'].gsub(/[\r|\n]/, ' ')}" }