Skip to content

Instantly share code, notes, and snippets.

View danishkhan's full-sized avatar

Danish Khan danishkhan

View GitHub Profile
@danishkhan
danishkhan / gist:605556
Created October 1, 2010 00:46
CSV-Mapper upload problem
class SalesController < ApplicationController
include CsvMapper
def csv_import
results = CsvMapper.import(params[:dump][:file].original_filename) do
map_to Sale
after_row lambda{|row, sale| sale.save }
start_at_row 1
[start_date, country]
@danishkhan
danishkhan / gist:605819
Created October 1, 2010 06:06
CSV-Mapper method
We couldn’t find that file to show.
@danishkhan
danishkhan / gist:777546
Created January 13, 2011 07:50
Radiant EY Setup
OVERWRITE=true ADMIN_NAME=admin ADMIN_USERNAME=admin ADMIN_PASSWORD=eypass DATABASE_TEMPLATE=styled-blog.yml rake db:bootstrap
** Invoke release (first_time)
** Execute release
rake aborted!
undefined method `grep' for "engineyard-serverside-adapter (1.4.0)\n":String
/Users/danishkhan/Projects/engineyard/Rakefile:40:in `bump_serverside_adapter'
/Users/danishkhan/Projects/engineyard/Rakefile:76:in `block in <top (required)>'
/Users/danishkhan/.rvm/gems/ruby-1.9.2-p136@global/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Users/danishkhan/.rvm/gems/ruby-1.9.2-p136@global/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute'
/Users/danishkhan/.rvm/gems/ruby-1.9.2-p136@global/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Users/danishkhan/.rvm/gems/ruby-1.9.2-p136@global/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
@danishkhan
danishkhan / MongoSF_Notes.md
Created May 25, 2011 00:14
Mongo Notes from MongoSF 20011

MongoDB Notes

Building Web Apps with MongoDB

MongoDB Schema Design

☁ mongod
mongod --help for help and startup options
Mon Aug 8 12:52:57 [initandlisten] MongoDB starting : pid=15166 port=27017 dbpath=/data/db/ 64-bit
Mon Aug 8 12:52:57 [initandlisten] db version v1.8.2, pdfile version 4.5
Mon Aug 8 12:52:57 [initandlisten] git version: 433bbaa14aaba6860da15bd4de8edf600f56501b
Mon Aug 8 12:52:57 [initandlisten] build sys info: Darwin erh2.10gen.cc 9.6.0 Darwin Kernel Version 9.6.0: Mon Nov 24 17:37:00 PST 2008; root:xnu-1228.9.59~1/RELEASE_I386 i386 BOOST_LIB_VERSION=1_40
Mon Aug 8 12:52:57 [initandlisten] exception in initAndListen std::exception: dbpath (/data/db/) does not exist, terminating
Mon Aug 8 12:52:57 dbexit:
Mon Aug 8 12:52:57 [initandlisten] shutdown: going to close listening sockets...
Mon Aug 8 12:52:57 [initandlisten] shutdown: going to flush diaglog...
☁ rvm install ree
Installing Ruby Enterprise Edition from source to: /Users/dkahn/.rvm/rubies/ree-1.8.7-2011.03
ree-1.8.7-2011.03 - #fetching (ruby-enterprise-1.8.7-2011.03)
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 7713k 100 7713k 0 0 2590k 0 0:00:02 0:00:02 --:--:-- 2605k
ree-1.8.7-2011.03 - #extracting ruby-enterprise-1.8.7-2011.03 to /Users/dkahn/.rvm/src/ree-1.8.7-2011.03
ree-1.8.7-2011.03 - #installing
ERROR: Error running './installer -a /Users/dkahn/.rvm/rubies/ree-1.8.7-2011.03 --no-tcmalloc --dont-install-useful-gems ', please read /Users/dkahn/.rvm/log/ree-1.8.7-2011.03/install.log
ERROR: There has been an error while trying to run the ree installer. Halting the installation.
[2011-08-17 16:19:19] ./installer -a /Users/dkahn/.rvm/rubies/ree-1.8.7-2011.03 --no-tcmalloc --dont-install-useful-gems
Welcome to the Ruby Enterprise Edition installer
This installer will help you install Ruby Enterprise Edition 1.8.7-2011.03.
Don't worry, none of your system files will be touched if you don't want them
to, so there is no risk that things will screw up.
You can expect this from the installation process:
1. Ruby Enterprise Edition will be compiled and optimized for speed for this
system.
☁ cat /Users/dkahn/.rvm/log/ree-1.8.7-2011.03/install.log
[2011-08-17 16:47:01] ./installer -a /Users/dkahn/.rvm/rubies/ree-1.8.7-2011.03 --no-tcmalloc --dont-install-useful-gems
Welcome to the Ruby Enterprise Edition installer
This installer will help you install Ruby Enterprise Edition 1.8.7-2011.03.
Don't worry, none of your system files will be touched if you don't want them
to, so there is no risk that things will screw up.
You can expect this from the installation process:
1. Ruby Enterprise Edition will be compiled and optimized for speed for this
@danishkhan
danishkhan / torrents_rss_downloader.rb
Created October 11, 2011 07:03
Script to automatically download torrents from an RSS feed
require 'rubygems'
require 'feedzirra'
require 'whenever'
=begin
Simple script to auto download new torrents from an RSS feed.
You can then utilize whenever and create a cronjob to run the
script at a specified interval.
=end