This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Why use VIM? | |
VIM rocks! | |
VI or VIM? | |
I hate the mouse! | |
I am a text person | |
I love touch-typing (huh - what is touch typing% again..) | |
You have production server with only SSH access! | |
2. Vim -- you already knew | |
Command mode & Insert mode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'redis' | |
require 'multi_json' | |
class PubSubRedis < Redis | |
def initialize(options = {}) | |
@timestamp = options[:timestamp].to_i || 0 # 0 means -- no backlog needed | |
super | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
'frozen' value for end_at in scope :active | |
The same frozen value is propogated to :national scope! | |
The Time.now will be set to the first time the scope is evaluated. | |
This is explained at http://api.rubyonrails.org/classes/ActiveRecord/NamedScope/ClassMethods.html | |
* NON-WORKING SOLUTION * | |
=end | |
class Something |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express') | |
, app = express.createServer() | |
, io = require('socket.io').listen(app); | |
app.use(express.bodyParser()); | |
app.listen(13002); | |
var connections = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module A | |
def foo | |
puts "A:foo" | |
end | |
end | |
module B | |
def foo | |
puts "B:foo" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Started POST "/reports/distributor" for 127.0.0.1 at 2013-03-19 15:02:16 +0530 | |
Processing by ReportsController#distributor as HTML | |
Parameters: {"utf8"=>"✓", "authenticity_token"=>"0auleqI26KHq7LL373WpzslaGJWy45LMhnPeEpWedoc=", "search"=>{"project_id"=>"5139f91fb9b67dbe3a000004", "distributor_id"=>"", "start_date"=>"01/03/2013 - 00:00 AM", "end_date"=>"20/03/2013 - 23:59 PM"}, "commit"=>"Search"} | |
MOPED: 127.0.0.1:27017 COMMAND database=admin command={:ismaster=>1} (0.5579ms) | |
MOPED: 127.0.0.1:27017 QUERY database=phalcomm_production collection=users selector={"$query"=>{"_id"=>"513f0f9db9b67d884a000002"}, "$orderby"=>{:_id=>1}} flags=[] limit=-1 skip=0 batch_size=nil fields=nil (0.4704ms) | |
MOPED: 127.0.0.1:27017 QUERY database=phalcom |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Started POST "/reports/distributor" for 127.0.0.1 at 2013-03-19 20:28:49 +0530 | |
Processing by ReportsController#distributor as HTML | |
Parameters: {"utf8"=>"✓", "authenticity_token"=>"0auleqI26KHq7LL373WpzslaGJWy45LMhnPeEpWedoc=", "search"=>{"project_id"=>"5139f91fb9b67dbe3a000004", "distributor_id"=>"", "start_date"=>"07/03/2013 - 00:00 AM", "end_date"=>"19/03/2013 - 23:59 PM"}, "commit"=>"Search"} | |
MOPED: 127.0.0.1:27017 COMMAND database=admin command={:ismaster=>1} (0.7286ms) | |
MOPED: 127.0.0.1:27017 QUERY database=phalcomm_production collection=users selector={"$query"=>{"_id"=>"513f0f9db9b67d884a000002"}, "$orderby"=>{:_id=>1}} flags=[] limit=-1 skip=0 batch_size=nil fields=nil (0.5398ms) | |
MOPED: 127.0.0.1:27017 QUERY database=phalcomm_production collection=organisations selector={"$query"=>{"_id"=>"5139f184b9b67d8e73000001"}, "$orderby"=>{:_id=>1}} flags=[] limit=-1 skip=0 batch_size=nil fields=nil (0.4199ms) | |
MOPED: 127.0.0.1:27017 QUERY database=phalcomm_production collectio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map = function() { | |
if (this.is_cancelled == false) { | |
data = { bookings: [ this._id ], | |
booking_amount: this.booking_amount, | |
amt_received: 0, | |
cancellations: 0 | |
} | |
} else { | |
data = { bookings: [], | |
booking_amount: 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GeneralEntity | |
include Mongoid::Document | |
extend Moped::Search # to enable facetted text index search | |
field :org_name, type: String | |
# other fields | |
embeds_one :contact, as: :contactable | |
index({"contact.state" => 1, # filter with text index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Address | |
include Mongoid::Document | |
field :street, type: String | |
field :city, type: String | |
field :state, type: String | |
field :zipcode, type: String | |
field :country, type: String | |
embedded_in :author, name: :permanent_address |
OlderNewer