Skip to content

Instantly share code, notes, and snippets.

View rupakg's full-sized avatar
😎
drinking from the firehose...

Rupak Ganguly rupakg

😎
drinking from the firehose...
View GitHub Profile
@emad-elsaid
emad-elsaid / weather.rb
Created February 21, 2014 14:53
get wheather of any city using ruby
require 'open-uri'
require 'json'
require 'psych'
city = 'portsaid,egypt'
request = "http://api.openweathermap.org/data/2.5/weather?q=#{city}"
response = open(request).readlines.join
print Psych.dump( JSON.parse(response) )
@dpetersen
dpetersen / demo.go
Last active August 29, 2015 14:13
Friday demo
package demo
// The Savable interface should be implemented by any resource associated with
// an Account that can be persisted.
type Savable interface {
Save(Account) (string, error)
}
// An Account ties together all records associated with a single client.
//
# Easy download examples
#
# First example, downloads 10 files from the same server sequencially using the same
# easy handle with a persistent connection
#
# Second example, sends all 10 requests in parallel using 10 easy handles
#
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'ext')))
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')))
require 'curb'
@therealadam
therealadam / Gemfile
Created June 18, 2010 18:45
An example of how to authorize your app with Gowalla's OAuth API
source :rubygems
gem 'sinatra', '1.0'
gem 'oauth2'
gem 'json'
group :development do
gem 'shotgun'
end
@rupakg
rupakg / Technology Stack for Rails.textile
Created October 19, 2010 06:38
Various technologies that I have narrowed down for use in my Rails apps.

Technology Stack for Rails

Core

  • Rails 3.0.1
  • Ruby 1.9.2 (use RVM for mgmt.)

Development

  • Bundler – manage gem dependencies
@rupakg
rupakg / Dev Gems
Created October 30, 2010 03:02
gemfile with dev stack
source 'http://rubygems.org'
gem 'rails', '3.0.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
#gem 'mysql2'
gem "sqlite3-ruby"
@mheadd
mheadd / tropo-bayeaux.html
Created December 17, 2010 19:07
Tropo / Bayeux Example for real time web connections
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Bayeux / Comet Test for Tropo</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script type="text/javascript" src="http://path/to/your/bayeaux/server/tropo.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$ rvm ruby-1.9.2-p136@ingredients
$ gem list
animalcracker (0.0.2)
bacon (1.1.0)
beet (0.6.9)
berry (0.0.0)
breadcrumbs (0.1.5)
butternut (0.2.1)
@aslakhellesoy
aslakhellesoy / chess.feature
Created January 26, 2011 00:38
Let's cuke some chess...
Feature: Validate moves
Scenario: Moving the knight illegally
Given the following board:
| | | | | | | | |8|
| | | | | | | | |7|
| | | | | | | | |6|
| | | | | | | | |5|
| | | |♞| | | | |4|
| | | | | | | | |3|
|♙| | | | | | | |2|
@gerred
gerred / .irbrc
Created June 17, 2011 18:27
My .irbrc file
if defined?(::Bundler)
global_gemset = ENV['GEM_PATH'].split(':').grep(/ruby.*@global/).first
if global_gemset
all_global_gem_paths = Dir.glob("#{global_gemset}/gems/*")
all_global_gem_paths.each do |p|
gem_path = "#{p}/lib"
$LOAD_PATH << gem_path
end
end
end