May 2013
12 posts
2 tags
delorean →
delorean - Delorean lets you travel in time with Ruby by mocking Time.now
1 tag
ruby on rails - Find (and kill) process locking... →
1 tag
MySQL Daily Automatic Backup Script →
http://www.systeminplace.net/forums/index.php?topic=13.0;wap2
1 tag
1 tag
Induction →
Induction - A Polyglot Database Client for Mac OS X
1 tag
Say Goodbye to Embarrassment →
http://www.aaronsw.com/weblog/emotions
2 tags
I hate TDD, but I do it anyway.
I hate TDD.
TDD is slow. It takes longer time to ship features. This is obvious as you have to code for the features as well as the tests.
TDD is wasted effort. During the early turbulant stage of an application development when business requirements change like a 16 year old’s hairstyle, 90% of tests you write will become useless later. They are usually not salvageable either as features...
1 tag
Why did Panasonic discontinue Technics SL1200 mk2?
This kind of shit people try to pull off on... →
http://programmers.stackexchange.com/questions/110487/my-customer-wants-me-to-record-a-video-of-how-i-develop-his-software-product
1 tag
A new way to spell debugger dubbeger
2 tags
Display current page's html in Cucumber
page.html
1 tag
mysqldump from one database to another using MYSQL...
mysqldump is used to dump the data of one database to another database. Normally command for mysqldump to dump data from database1 to database2 goes something like the following.
mysqldump -h [host1] -P [port1] -u [user1] -p[password1] [database1] | mysql -h [host2] -P [port2] -u [user2] -p[password2] [database2]
But you might get this kind of error.
mysqldump: Got error: 2003: Can't connect...
April 2013
5 posts
1 tag
Programming level function
programming_godliness is a function of time
1 tag
One hour a day
I am going to make a commitment. For the foreseeable future, I am going to dedicate at least one hour to do something to better myself everyday. And it starts now!
2 tags
Hi kids. Make sure you match the Passenger...
If you don’t, Passenger will spit out this error message.
database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified)
Prior to not knowing why this was occurring, I checked everything! Were my gems installed in the right location where the Passenger server was pulling the gems from? Yes. Ok, maybe my database configs are wrong. Does my mysql database credentials...
1 tag
2 tags
Negate function in Eloquent Javascript's...
Just had a bit of wtf moment over this function from Eloquent Javascript.
function negate(func) {
return function(x) {
return !func(x);
};
}
Negate function takes another function as an argument. It returns another function that takes an argument. The other function that gets returned is a negation of the original function with the argument.
As an example,
var isNotNaN =...
March 2013
4 posts
1 tag
Closure in Javascript
Sometimes javascript is really cool.
function makeAdder(amount) {
return function(number) {
return number + amount;
}
}
var addTwo = makeAdder(2);
addTwo(3);
-> 5
edit: good catch, phortx. Thanks, it’s fixed now.
1 tag
All the rake db in one line
Another way to do
rake db:drop
rake db:create
rake db:migrate
rake db:seed
is
rake db:drop db:create db:migrate db:seed
1 tag
Nostalgia
We are a generation that wants to live in the past, not the future. Even when we dream about the future forward, we long it to belong in the past, the good old days. We live in a digital age that wants to emulate the lifestyles of analogue, slow but firm, a few in numbers but genuine, experience something rich and authentic. But we can never go back. There was a turn somewhere along the road,...
1 tag
So meta
`Object.class_eval(‘self’)` is `Object`.
January 2013
1 post
December 2012
4 posts
1 tag
Showing some love for Javascript
hackedy:
there are at least 18 different ways to do object oriented programming in Javascript and 17 of them are wrong.
1 tag
IDE right on top of Github! Make it happen, someone.
1 tag
planet phortx: Linux: What I think after 7 years →
phortx:
I switched from windows to linux about 7 years ago. At work I’ve never used anything else. And at home I was switching between windows and linux via dual boot depending on what I wanted to do: Gaming or coding.
In these years I worked nearly 8-16 hours per day with linux. And I’ve worked with a…
1 tag
November 2012
10 posts
1 tag
1 tag
Markdown needs nested lists.
1 tag
Kill trailing white spaces cancer in Sublime Text... →
"trim_trailing_white_space_on_save": true in Settings - User.
1 tag
Boolean field presence validation →
If you want to validate the presence of a boolean field you should use validates :field_name, :inclusion => { :in => [true, false] }.
2 tags
Rendering Rails 3.1 or newer assets to string →
YourApp::Application.assets.find_asset('api.css').body
Looked everywhere for this line!
1 tag
How to Live Without Irony →
1 tag
The Strokes basically started post 9-11 hipster culture that permeated throughout the psyche of the youths.
hackedy:
“connect with”
no
“You should follow”
No
1 tag
Editing hosts file for Android emulator on Mac OS...
Web developers who are using Android emulator to check the content on Android environment might have noticed that they can’t connect that localhost created by the local machine. This puzzled me as I thought the Android emulator running on local machine should have no problem accessing localhost created by the same local machine.
After some research, I found out that Android emulator is...
1 tag
Send SMS locally on Android Emulator
Make sure the Android emulator is fired up.
Enter this in the terminal
$ telnet localhost 5554
Messages like this should pop up.
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Android Console: type 'help' for a list of commands
OK
Now to send sms …
sms send <any phone number> <any...
October 2012
10 posts
1 tag
3 tags
Dealing with: Modal dialog present...
If your Cucumber test encounters a javascript alert in the browser, it will throw this sort of error.
Modal dialog present (Selenium::WebDriver::Error::UnhandledAlertError)
[remote server] file:///var/folders/s0/xyrbzq_j7h32jq4n3g53c2kc0000gp/T/ ...
To avoid this error, you have to close the alert message. In the custom steps file, for the particular step that’s throwing the error, add...
1 tag
Create Haml View for Ruby on Rails Devise Gem →
1 tag
Things I take when I move
I moved around so many times. Ever since I started going to university, frequency of moving around increased even more. I don’t think I’ve stayed in one place for more than a year since 2006. Because I moved so frequently, I had to really cut down on things I bring around.
Electronics
Macbook
Cell phone (not smartphone)
Camera (shitty one from 2006)
Clothes
White tshirt (1)
...
More javascript sorcery. == and === →
2 tags
Currying in Scala
Coursera: Functional Programming Principles in Scala with Martin Odersky
Why Currying?
def sumInts(a: Int, b: Int) = sum(x => x, a, b)
def sumCubes(a: Int, b: Int) = sum(x => x * x * x, a, b)
def sumFactorials(a: Int, b: Int) = sum(fact, a, b)
The three functions above all have a, b as parameters. It gets passed unchanged from sumInts to sum. What if I told you Currying can get rid of...
2 tags
Higher-Order Functions in Scala
Higher-Order Functions in Scala
// Sum of all integers between a and b
def sumInts(a:Int, b:Int):Int =
if (a>b) 0
else a + subMints(a+1, b)
// Sum of cubes of all integers between a and b
def sumCubes(a:Int, b:Int):Int =
if (a>b) 0
else cube(a) + subCubes(a+1, b)
def cube(a: Int) =
x * x * x
// Sum of factiorials of all integers between a and b
def sumFactorials(a:Int,...
2 tags
Set up for backbone
Backbone.js has a dependency, Underscore.js. You must add underscore.js in order to work with Backbone.js. Related Stackoverflow thread
September 2012
5 posts
1 tag
2 tags
My first Scala program
Yup, it’s hello world and the file’s called Hello.scala.
package greeter
object Hello extends App {
println("Hello world!")
}
4 tags
Clicking on image as link using Capybara in...
There seems to be a lot of convoluted way of doing this. But after some research, it turns out click_link method does have ability to click image links found by alt.
If you had some Haml code like below you wanted to test …
=link_to image_tag('logo.png', :alt => 'rhapsody-logo'), 'http://www.rhapsody.com'
In order to click this logo image link with Capybara …
...
3 tags
Resize YouTube video fit into browser like...
Youtube Leanback gives a pretty awesome native app feel. I was wondering how their video is automatically resized to fit the browser. I tried to use Chrome inspector to checkout how Leanback video is resized, but the code is minified to obscurity that you can’t read it. I also checked out fitvidsjs and Chris Coyier’s solution to similar problem. But these two suggestions work only for...