Skip to content

Instantly share code, notes, and snippets.

Avatar

Kensuke Nagae kyanny

View GitHub Profile
View capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@rcrowley
rcrowley / gist:447393
Created Jun 21, 2010
Resque Nagios plugin
We couldn’t find that file to show.
View escfilter
#!/usr/bin/env perl
use strict;
use warnings;
use Getopt::Long qw(HelpMessage VersionMessage);
use Term::ANSIColor qw(colored);
our $VERSION = '0.01';
$VERSION = eval $VERSION;
my %color_map = (
@priithaamer
priithaamer / config.ru
Created Oct 21, 2010
Gollum rackup script
View config.ru
#!/usr/bin/ruby
require 'rubygems'
require 'gollum/frontend/app'
system("which git") or raise "Looks like I can't find the git CLI in your path.\nYour path is: #{ENV['PATH']}"
gollum_path = '/Users/priit/Documents/Fraktal/Wiki'
disable :run
@keithamus
keithamus / Nano Git Commit Syntax highlighting
Created Dec 10, 2010
Add this to your ~/.nanorc and when running "git commit" (if your editor is nano) you'll have syntax highlighting in your commit message. Includes support for "git commit -v" too!
View Nano Git Commit Syntax highlighting
syntax "gitcommit" "COMMIT_EDITMSG$"
color white "#.*"
color green "#.(modified|deleted).*"
color yellow start="# Changes.*" end="# Changed.*"
color cyan start="# Untracked.*" end="diff"
color cyan start="# Untracked.*" end="$$"
color brightred "^deleted file mode .*"
color brightgreen "^\+.*"
color brightred "^-.*"
color brightyellow "^(diff|index|---|\+\+\+).*"
@yoggy
yoggy / ldr2pin.rb
Created Jan 12, 2011
Livedoor ReaderのPinをまとめてpinboard.inにブックマークするスクリプト
View ldr2pin.rb
#!/usr/bin/ruby
#
# ldr2pin.rb - Livedoor ReaderのPinをまとめてpinboard.inにブックマークするスクリプト
#
$KCODE='utf8'
require 'rubygems'
require 'net/netrc'
require 'mechanize'
@tyuki39
tyuki39 / waitjob.groovysh
Created Feb 26, 2011
Jenkinsで、指定ジョブがビルド中でない場合は即実行、指定ジョブがビルド中の場合は待って実行する例
View waitjob.groovysh
//
// 1. depjobnameで指定したジョブよりも自分自身が先にキューに入った場合は、自分自身のビルドを即実行する。
// 2. depjobnameで指定したジョブよりも自分自身が後にキューに入った場合は、depjobnameの終了を待つ。
// 2-1. ポーリング方式で終了を待つ
// 2-2. 最大リトライ回数は retrycount で指定
// 2-3. リトライ間隔は sleeptime で指定(単位はミリ秒)
// 3. depjobnameで指定したジョブが存在しなかった場合は、ビルドを失敗させるためにあえて例外が発生する
// ようにしています。
// 4. 設定手順
// 4-1. Groovy Pluginをインストールする
@juliocesar
juliocesar / best-localStorage-polyfill-evar.js
Created Apr 18, 2011
This is the best localStorage polyfill in the world
View best-localStorage-polyfill-evar.js
// I mean, seriously, localStorage is supported even by your mum. How about instead of
// casing the feature out, you give users in-memory (stale) storage instead?
// If they close your application, they deserve to lose data anyway.
// if (!('localStorage' in window)) {
if (!Modernizr.localstorage) {
window.localStorage = {
_data : {},
setItem : function(id, val) { return this._data[id] = String(val); },
getItem : function(id) { return this._data.hasOwnProperty(id) ? this._data[id] : undefined; },
@tobert
tobert / config.ru
Created May 18, 2011
Gollum rackup for Unicorn
View config.ru
$: << 'lib'
require 'rubygems'
require 'gollum'
require 'gollum/frontend/app'
use Rack::ShowExceptions
Precious::App.set(:gollum_path, Dir.pwd)
Precious::App.set(:wiki_options, {})
@sasimpson
sasimpson / gist:1112739
Created Jul 28, 2011
Ruby Net:HTTP chunked transfer
View gist:1112739
require 'uri'
require 'net/http'
class Chunked
def initialize(data, chunk_size)
@size = chunk_size
if data.respond_to? :read
@file = data
end
end
You can’t perform that action at this time.