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') |
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 = ( |
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 |
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|---|\+\+\+).*" |
View ldr2pin.rb
#!/usr/bin/ruby | |
# | |
# ldr2pin.rb - Livedoor ReaderのPinをまとめてpinboard.inにブックマークするスクリプト | |
# | |
$KCODE='utf8' | |
require 'rubygems' | |
require 'net/netrc' | |
require 'mechanize' |
View waitjob.groovysh
// | |
// 1. depjobnameで指定したジョブよりも自分自身が先にキューに入った場合は、自分自身のビルドを即実行する。 | |
// 2. depjobnameで指定したジョブよりも自分自身が後にキューに入った場合は、depjobnameの終了を待つ。 | |
// 2-1. ポーリング方式で終了を待つ | |
// 2-2. 最大リトライ回数は retrycount で指定 | |
// 2-3. リトライ間隔は sleeptime で指定(単位はミリ秒) | |
// 3. depjobnameで指定したジョブが存在しなかった場合は、ビルドを失敗させるためにあえて例外が発生する | |
// ようにしています。 | |
// 4. 設定手順 | |
// 4-1. Groovy Pluginをインストールする |
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; }, |
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, {}) |
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 |
OlderNewer