avatar

An hero

coder by day, an hero by night

typing at the speed of thought

Every thousand miles journey begins with the first step.

My coding journey begins with learning how to type, so I wrote this qwerty tutorial

I was going to extend it for dvorak…but found Learn typing at the speed of thought!

read more...

The Sidekiq of 8 processes on Heroku Performance Dyno

So…I had the honor of doing some data migration, which happens to be CPU, and memory intensive.

I called upon Heroku PX Dyno and the Sidekiq with the wrath of one process and 100 threads.

1
2
# loading PX with one process and 100 threads
$ heroku...
read more...

ruby defined? operator

Run this on ruby 1.9

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require 'delegate'

class Bam < SimpleDelegator
  def bam
    defined? Bam
  end

  def rails
    defined? Rails
  end
end

module Rails; end

bam = Bam
read more...

IRC#ruby-lang

Ah good old Internet Relay Chat, haven't used that in like ever. But found out that it's the best source of help one could get on ruby.

Setup

I got a Mac, so I roll with Colloquy. Then connect to irc.freenode.net server and join ruby-lang channel...

read more...

gotcha: ruby += operator

Looks like there's no += operators. My guess is compiler is probably converting a += b expressions into a = a + b, or more verbosely a.send(:=, a.send(:+, b)).

Here's some quick experimentation:

1
2
3
4
irb> 0.send("+=", 1)
# => NoMethodError: undefined...
read more...

Devise Authentication unscoped

At Shop2 we do the Rails 3.2, Mongoid 2.4, and Devise 2.0. We found that Devise by default does not play nice with default scoping.

1
2
3
4
5
6
7
8
9
10
11
12
13
# Our User model with default_scope of active users,
# and a :vip scope
#
class User
read more...

Claim back Snow Leopard speed from Lion

At Shop2, we use the Mac platform heavily for development. But the vim on Mac OSX Lion is just so darn slow, especially autocomplete. One of our engineers has this clever idea of disabling Spotlight. BAM! The vim feels speedier once again.

The only...

read more...

Page 3 of 3

← Previous