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
@rupakg
rupakg / text2img.rb
Created March 11, 2009 01:12
convert text to image
require "mini_magick"
image = MiniMagick::Image.from_file("c:\\test.jpg")
image.resize "100x100"
image.write("c:\\output.jpg")
@rupakg
rupakg / gradiantfill.rb
Created March 11, 2009 03:33
Create images using Magick
require 'RMagick'
include magick
# Demonstrate the GradientFill class
Rows = 100
Cols = 300
Start = "#900"
End = "#000"
@rupakg
rupakg / irbrc.txt
Last active August 30, 2015 02:54
IRBRC settings
.irbrc for Win32
Create a file called anything you like (e.g. “_irbrc” or “irb.rc”) and place it anywhere you like (say C:\Documents and Settings\), and set that full path to the ENV variable IRBRC, e.g. C:\Documents and Settings\\_irbrc
## Libraries
require 'rubygems'
require 'irb/completion'
require 'map_by_method'
require 'what_methods'
require 'pp'
@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"
@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"
@rupakg
rupakg / generate_passkey.rb
Last active September 24, 2015 03:28
SHA1
require 'hmac-sha1'
require 'digest/sha1'
require 'base64'
token="-Sat, 14 Nov 2009 09:47:53 GMT-GET-/video.xml-"
private_key="whatever"
salt=Digest::SHA1.hexdigest(token)[0..19]
passkey=Base64.encode64(HMAC::SHA1.digest(private_key, salt)).strip
Coffeescript:
masterTableView = new TableView
id:'masterView'
data:tableData
layout:'vertical'
style: Titanium.UI.iPhone.TableViewStyle.GROUPED
editable:true <=========
complies to JS:
domDocument = Titanium.XML.parseString(this.responseText)
domNodeList = domDocument.getElementsByTagName("Contents")
objectsList = [];
for (var i = 0; i < domNodeList.length; i++)
{
keyName = item.getElementsByTagName('Key').item(0).textContent;
size = objects[i].getElementsByTagName('Size').item(0).textContent;
objectsList[i] = {
key: keyName,
@import compass/css3
$color-light: #fff
$color-grey: #ddd
$color-dark: #000
//--------------------------------------------------------------------------------
// I started out like this, getting all
// carried away with how awesome Sass