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
=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') |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project name="${projectName}" basedir="." default="build:main"> | |
<!-- Properties --> | |
<property name="dir.app" value="${project.basedir}/app" /> | |
<property name="dir.src" value="${project.basedir}/src" /> | |
<property name="dir.build" value="${project.basedir}/app/build" /> | |
<property name="dir.docs" value="${dir.build}/docs" /> | |
<property name="dir.docs.phpdoc" value="${dir.docs}/phpdoc" /> | |
<property name="dir.docs.docblox" value="${dir.docs}/docblox" /> | |
<property name="dir.reports" value="${dir.build}/logs" /> |
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
#!/bin/bash | |
# per-user install | |
echo 'if [ -z "$(type rbenv 2> /dev/null | head -1 | grep function)" ]; then' >> ~/.bashrc | |
echo ' export RBENV_ROOT=/usr/local/rbenv' >> ~/.bashrc | |
echo ' export PATH=$RBENV_ROOT/bin:$PATH' >> ~/.bashrc | |
echo ' eval "$(rbenv init -)"' >> ~/.bashrc | |
echo 'fi' >> ~/.bashrc |
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
# coding: utf-8 | |
# | |
# 1行目がヘッダ、2行目からレコードの始まる典型的なCSVだけど | |
# 標準のCSVライブラリではCSV::MalformedCSVErrorが起きるCSVの処理 | |
# | |
# 1. File.openで開き、file.readlines[1..-1]で1行目を飛ばして読み込む | |
# 2. line.split(/,/)でコンマで区切って配列に変換する | |
# 3. あとはいつも通りに | |
# |
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
:javascript | |
var _gaq = _gaq || []; | |
_gaq.push(['_setAccount', YOUR_CODE']); | |
_gaq.push(['_trackPageview']); | |
(function() { | |
var ga = document.createElement('script'); | |
ga.type = 'text/javascript'; ga.async = true; | |
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | |
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); | |
})(); |
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
# Exclude the file upload and WP CRON scripts from authentication | |
<FilesMatch "(async-upload\.php|wp-cron\.php|xmlrpc\.php)$"> | |
Satisfy Any | |
Order allow,deny | |
Allow from all | |
Deny from none | |
</FilesMatch> |
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
#!/bin/sh | |
if [ -z "$1" ]; then | |
echo Usage: $0 {config-file} | |
exit | |
fi | |
vim -N -u NONE -i NONE -V1 -e -s --cmd "source $1" --cmd NeoBundleInstall! --cmd qall! |
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
Browser = require "zombie" | |
username = process.argv[2] | |
password = process.argv[3] | |
message = process.argv[4] | |
browser = new Browser (debug:true, runScripts:false) | |
browser.visit "https://mobile.twitter.com/session/new", -> | |
browser.fill "username", username | |
browser.fill "password", password |
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/lib64/fluent/ruby/bin/ruby | |
# -*- encoding: utf-8 -*- | |
# GrowthForecastのAPIを使って複合グラフを作るサンプル | |
# 仕様はこのへん読もう | |
# https://github.com/kazeburo/GrowthForecast/blob/master/lib/GrowthForecast/Web.pm | |
# | |
# <service_name>/access/{2xx_count,3xx_count,4xx_count,5xx_count} | |
# ↓ | |
# <service_name>/access/access_status |
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 bash | |
function suddenize() { | |
typeset text hit length i header footer | |
text=$1 | |
hit=0 | |
for i in $( seq 1 ${#text} ); do | |
hit=$(( $hit + $(expr $text[$i] : '[ -~]') )) | |
done | |
length=$(( ${#text} - $(( $hit / 2 )) + 2 )) |
OlderNewer