Skip to content

Instantly share code, notes, and snippets.

View sanemat's full-sized avatar
🍢

Matt Murahashi Kenichi sanemat

🍢
View GitHub Profile
@sr
sr / gist:151557
Created July 21, 2009 20:02
Client side caching for net/http using rack/client and rack/cache
require "rack/client"
require "rack/cache"
require "rack/test"
app = Rack::Builder.new {
use Rack::Cache,
:verbose => true,
:metastore => "heap:/",
:entitystore => "heap:/"
run Rack::Client
@client ||= Rack::Client.new(@base_uri) do
use Rack::Client::Auth::Basic, @user, @pass
use Rack::Client::ParseXml
run Rack::Client::Handler::NetHTTP
end
@client.get('/foo.xml')
@defunkt
defunkt / clients.md
Created April 18, 2010 14:09
A list of Gist clients.

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support

# This extends the behavior of Rake to allow you to see all of the dependencies
# of a Rake task recursively, not just the immediate dependencies.
#
# It adds a -d option (also called --dependency-tree). Left blank, this
# option shows you dependencies for all Rake tasks. Alternatively, you
# can pass a regular expression to this option and it will only show
# dependencies for matching tasks.
#
# To use this special version of Rake, save it in a Ruby file called
# raketree.rb (but the name really doesn't matter). Here are some examples of
@koseki
koseki / Rakefile
Created June 30, 2010 08:32
update trac wiki using text file.
require 'rubygems'
require 'tempfile'
require 'mechanize'
# *.txt format:
# ----------------------------------------------
# http://your/track/wiki/page 1(version nuber)
# contents
# :
# :
source 'http://rubygems.org'
gem 'rails', '3.0.0'
gem 'sqlite3-ruby', :require => 'sqlite3'
group :development, :test do
gem 'rspec','>=2.0.0.beta.20'
gem 'rspec-rails','>=2.0.0.beta.20'
gem 'ZenTest'
gem 'autotest'
@ursm
ursm / Gemfile
Created September 3, 2010 05:15
group :test do
gem 'rspec-rails', '>= 2.0.0.beta', :group => :development
gem 'rspec-integration', '>= 2.0.0.beta'
gem 'rr'
gem 'database_cleaner'
gem 'capybara'
gem 'launchy'
gem 'autotest-rails'
gem 'machinist_mongo', :require => 'machinist/mongoid'
@yanbe
yanbe / gist:961328
Created May 8, 2011 12:02
iPhoneのSafariのブックマークレットに選択文字列を渡すサンプル(Safariでブラウジング中に大辞林アプリで選択中の単語を調べる)
javascript:document.addEventListener('gesturestart',function()%7Bvar%20w=window.getSelection();if(w!=%22%22)window.location='mkdaijirin://jp.monokakido.DAIJIRIN/search?text='+encodeURIComponent(w)+'&srcname=Safari&src='+encodeURIComponent(location.href)%7D,false);
/*
前準備:
上記をiPhoneのSafariのブックマークとして登録
使い方:
1. Safariでブラウジング中調べたい単語が見つかったら,ブックマークレットを起動する
 (この段階では何も起こらない.実際にはユーザーがタッチパネル上で何らかのジェスチャーを行なったときに
  発動するイベントがページに仕込まれる)
@JohannesRudolph
JohannesRudolph / TeamCityAdapter.m
Created May 27, 2011 08:53
TeamCity Adapter for SenTestingKit/OCUnit
//
// TeamCityAdadpter.m
// Created by Johannes Rudolph on 27.05.11.
// Use of this source code is governed by the following license:
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// (1) Redistributions of source code must retain the above copyright notice,
@nihen
nihen / gist:1178857
Created August 29, 2011 17:13
isucon app
use 5.14.1;
use Plack::Request;
use Plack::Builder;
use FindBin;
use Text::Xslate::Util qw/html_escape/;
use POSIX qw/strftime/;
use List::Util qw/first/;
use JSON::XS;
use IO::Handle;
use Encode;