Skip to content

Instantly share code, notes, and snippets.

View zerothabhishek's full-sized avatar

Abhishek Yadav zerothabhishek

View GitHub Profile
# To produce a database.yml file for production environment,
# while installing with Capistrano, and using
# database initialization recipe from here - http://gist.github.com/2769
# for rails3-mysql
production:
adapter: mysql2
database: <%= "#{application}_production" %>
##
# How to run:
# ruby scrape.alexa.rb
#
# Output:
# 20 files each with the data in csv format
#
# Dependencies:
# ruby version > 1.9 # "ruby -v" to check
# nokogiri gem # "gem install nokogiri" to install
@zerothabhishek
zerothabhishek / [email protected]
Created November 24, 2012 09:44
spree@chennaigeeks

SPREE

Intro

e-commerce software
open-source
rails/ruby based
For programmers

@zerothabhishek
zerothabhishek / gist:11108206
Last active August 29, 2015 14:00
chennai.rb-april-meetup
## open class
class Array
def second_last
self[-2]
end
end
class Array
def first
@zerothabhishek
zerothabhishek / workshop-program-1st-Nov
Created October 28, 2014 01:28
Workshop program 1st-Nov
## Program Nov-1
Sessions:
- TryRuby
- Before Rails
~~ Lunch
- Sinatra
- Rails-1
~~ Tea Break
@zerothabhishek
zerothabhishek / gist:bba03d4a28977d17284d
Last active August 29, 2015 14:17
ruby-case-when-with-lambda
def foo(x)
case x
when 10 then 'The number Ten'
when String then 'A String'
when lambda{|x| x%2==1 } then 'An odd number'
when (1..9) then 'In range'
end
end
Confreaks:
http://confreaks.tv/videos/larubyconf2013-refactoring-fat-models-with-patterns
http://confreaks.tv/videos/railsconf2015-nothing-is-something
http://confreaks.tv/videos/railsconf2012-ten-things-you-didn-t-know-rails-could-do
http://confreaks.tv/videos/burlingtonruby2014-breaking-up-with-the-asset-pipeline
http://confreaks.tv/videos/railsconf2015-docker-isn-t-just-for-deployment
http://confreaks.tv/videos/rubyconf2014-enumerable-for-fun-profit
http://confreaks.tv/videos/rubymanor3-programming-with-nothing
@zerothabhishek
zerothabhishek / explain-join-1.sql
Last active December 1, 2015 03:21
Sql left Join
SELECT posts.*, comments.*
FROM posts LEFT JOIN comments
ON posts.id = comments.post_id;
@zerothabhishek
zerothabhishek / explain-join-2.sql
Last active December 1, 2015 03:19
Explain Join with indexes
EXPLAIN
SELECT posts.*, comments.*
FROM posts LEFT JOIN comments
ON posts.id = comments.post_id;
# Before adding indexes
QUERY PLAN
------------------------------------------------------------------------
Hash Right Join (cost=394.50..2589.00 rows=50000 width=150)
@zerothabhishek
zerothabhishek / nov-minutes.md
Created December 1, 2015 10:06
Minutes of November meet-up

The November 2015 meetup was held at the Postmark office on 21st. Here are some pictures.

The meet-up began with an introductory talk about the host company by Mithin. After that we went into the first talk, Speed up Mongo, by Gaurav Shah. The talk was about various lessons learned about Mongo performance in production. The talk also spawned many minor discussions via which we went into some other nitty-gritties of Mongo-Db. The slides are worth a look if you are planning to use Mongo for a project, and are curious about scaling.

The second talk was on Fraud Detection and Prevention in Ecommerce by Ketan Jain. This talk was about the many techniques that Postmark and similar companies apply to check fraud. An interesting and relatable talk, as many scenarios discussed are applicable in In