Skip to content

Instantly share code, notes, and snippets.

View soramugi's full-sized avatar
🦭
I always want to lie down

Y.Tsuyuzaki soramugi

🦭
I always want to lie down
View GitHub Profile
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
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')
@hectorsanjuan
hectorsanjuan / build.xml
Created September 17, 2011 18:22
Phing build.xml for Symfony2 projects
<?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" />
@antage
antage / install-rbenv-user.sh
Created December 1, 2011 14:56
System wide install rbenv on Debian
#!/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
@ohnishiakira
ohnishiakira / gist:2005628
Created March 9, 2012 08:21
標準のCSVライブラリではCSV::MalformedCSVErrorが起きるCSVの処理
# coding: utf-8
#
# 1行目がヘッダ、2行目からレコードの始まる典型的なCSVだけど
# 標準のCSVライブラリではCSV::MalformedCSVErrorが起きるCSVの処理
#
# 1. File.openで開き、file.readlines[1..-1]で1行目を飛ばして読み込む
# 2. line.split(/,/)でコンマで区切って配列に変換する
# 3. あとはいつも通りに
#
@owainlewis
owainlewis / _analytics.haml
Created March 9, 2012 20:06
Google Analytics HAML
: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);
})();
@show555
show555 / .htaccess
Created March 15, 2012 01:05
Basic認証下でWP Cronを動かす
# 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>
@thinca
thinca / neobundle
Created August 22, 2012 02:14
neobundle command
#!/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!
@ntotani
ntotani / tweetZombie.coffee
Created September 6, 2012 14:10
tweet message by Zombie.js
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
@mikeda
mikeda / gist:4406576
Last active December 30, 2020 14:34
GrowthForecastでAPIを使って複合グラフを作るサンプル
#!/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
@rummelonp
rummelonp / suddenize
Last active December 11, 2015 06:08
突然の死
#!/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 ))