Skip to content

Instantly share code, notes, and snippets.

#spec/routing/pages_routing_spec.rb
require 'spec_helper'
describe 'routes to the pages controller' do
describe 'GET root_path' do
subject { {:get => root_path} }
it { should be_routable }
it { should route_to :controller => 'pages', :action => 'home' }
require 'sinatra'
require 'open-uri'
require 'json'
OAUTH_URL = 'https://foursquare.com/oauth2'
BASE_URL = 'https://api.foursquare.com/v2'
REDIRECT_URI = 'http://localhost:9292/auth'
CLIENT_ID = 'YOUR_CLIENT_ID'
CLIENT_SECRET = 'YOUR_CLIENT_SECRET'
@yohfee
yohfee / google_language.rb
Created January 21, 2011 02:06
google_language.rb
# coding: utf-8
require 'open-uri'
require 'json'
module GoogleLanguage
extend self
URL = "http://ajax.googleapis.com/ajax/services/language/translate"
@yohfee
yohfee / convert.sh
Created January 8, 2011 14:05
convert.sh
for jpeg in `find . -name "*.JPG"`
do
convert -geometry 28.4090909% $jpeg ${jpeg%.*}.jpg
done
@yohfee
yohfee / Gemfile
Created December 22, 2010 07:08
heroku_db_sample.rb
source 'http://rubygems.org'
gem 'sinatra'
gem 'dm-core'
gem 'dm-postgres-adapter'
require 'System.Windows.Forms'
include System::Windows::Forms
f = Form.new
b = Button.new
b.text = 'Hello'
b.click.add lambda{|s, e| MessageBox.show(s.text)}
f.controls << b
f.show_dialog
# coding: utf-8
require 'test/unit'
require File.join(File.dirname(File.expand_path(__FILE__)), '..', 'lib', 'zenra')
class ZenraTest < Test::Unit::TestCase
def setup
@appid = ENV['YAHOO_APPID']
end
require 'android'
require 'webrick'
pic = '/sdcard/snapshot.jpg'
droid = Android.new
httpd = WEBrick::HTTPServer.new(:Port => 9998)
httpd.mount_proc('/') do |req, res|
return unless req.path == '/'
droid.cameraCapturePicture(pic)
require 'rubygems'
require 'spec'
require File.dirname(__FILE__) + '/../src/RSpecExample/bin/Debug/RSpecExample.dll'
include RSpecExample
describe Sample do
context "with args 'hoge', 'fuga' and 'piyo'" do
subject{ Sample.new('hoge', 'fuga', 'piyo') }
its(:Greet){ should == 'Hello hoge,fuga,piyo' }
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text.RegularExpressions;
namespace Bipolarization
{
class Program
{
static void Main(string[] args)