Wednesday, December 5, 2012

Using Rails.env in SASS

You can add your custom scripts to SASS easily, but make sure the following code loads in your config.rb/application.rb or somewhere along the line. and here is how you can use them

Friday, November 16, 2012

Copy a file from a different branch in Git

where BRANCH can be any ref (branch, tag, HEAD, ...)

Wednesday, October 31, 2012

Retrieving the results of last command in ZSH

If you ever wished to retrieve the output of the last command to use it as an argument.

Saturday, October 20, 2012

Sluggish streaming with AirPlay

If you experience sluggish sometime stopping streaming with AirPlay try switching the Wireless Channel from Automatic to a specific channel (i.e. Channel 9).
Other AirPlay devices may interfere with yours.
This happened when my neighbour turned on his own AirPort Express.

Friday, October 12, 2012

SASS support in Chrome web inspector

Google Chrome has experimental SASS support in web inspector.

To turn it on, open
enable Enable Developer Tools experiments.

You may have to reload web inspector to make settings apply.

Then open web inspector settings (the little cog icon on the bottom right)
You see a new tab, Experiments

Select Support for SASS.

To make it work your generated CSS needs to include line numbers, which with Chrome can connect your CSS to SASS.
If you're using the command line compiler --line-numbers will do the job.

If everything works you should see SASS code when inspecting elements.

Friday, October 5, 2012

When you should use Mixins, Extend, Functions in SCSS

SCSS provides three powerful ways of code reuse, Mixins, Extend and Functions.

Use Mixins if similar sets of properties used multiple times with small variations.

Use Extend if sets of properties that match exactly.

Use Functions for commonly-used operations to determine values

Wednesday, September 12, 2012

Questions For Job Candidates To Ask

What do you expect me to accomplish in the first 60 to 90 days?

What are the common attributes of your top performers?

What are a few things that really drive results for the company?

What do employees do in their spare time?

How do you plan to deal with technological changes/competitors entering the market/shifting economic trends?

You can find details in this Inc's article.

Tuesday, August 21, 2012

Smiling profile pictures make a difference

At my company one employee took the effort to take a profile picture of every employee. He only took photos where people smiling, it took some time but within few weeks (100+ employees) it is done.

Then everyone was asked to replace their profile picture in hipchat/google apps/yammer to the one taken. Everyone agreed, and as a result I only see smiling faces in the apps these days.

It feels good.

Smiling pictures make a difference.

Saturday, July 14, 2012

Using pasteboard from command line on OSX

pbcopy, pbpaste - provide copying and pasting to the pasteboard (the Clipboard) from command line. Here are few examples

Tuesday, July 10, 2012

Generating video with gource and ffmpeg

Gource is a software version control visualization tool, and with ffmpeg you can generate a video of your repo visualization easily.

Monday, July 9, 2012

Taking screenshot on Android devices

  1. First of all you’ll need to download, install and configure Android SDK, along with the USB drivers.
  2. Enable USB Debugging mode. You can do that from Settings -> Applications -> Development.
  3. Connect your Android device to a PC via USB cable.
  4. Go to the “tools” folder in Android SDK and start the batch file titled “ddms” to launch the Dalvik Debug Monitor Service. You should be able to see your device connected on top.
  5. Under the “Device” menu, within the Debugger window, click “Screen Capture” or press Ctrl + S.

Tuesday, June 12, 2012

Amal's Guide to Storyboarding

A storyboard (in HCI) is a comic-strip-like set of drawings about what your interface does and how it is used to accomplish tasks in a real usage scenario.

A good storyboard should clearly demonstrate who the user is, the usage situation, and the user's motivations for using the interface.

It should show what the user can accomplish with your interface, but it needn't (and often shouldn't) show a specific user interface design.

  • People involved?
  • Environment?
  • Task being accomplished?
  • What steps are involved?
  • What leads someone to use the app?
  • What task is being illustrated?
  • What's the motivation for the user?
  • What's the end result?
  • What need are you "satisfying"?
You can find here the full version of Amal Dar Aziz's excellent Guide to Storyboarding.

Friday, June 8, 2012

Thursday, June 7, 2012

Difference Between Unicode and UTF-8

Unicode is the standard for computers to display and manipulate text while UTF-8 is one of the many mapping methods for Unicode.

UTF-8 is a mapping method the retains compatibility with the older ASCII.

UTF-8 is the most space efficient mapping method for Unicode compared to other encoding methods.

UTF-8 is the most used Unicode standard for the web.

Thursday, May 24, 2012

Questions for your company

When I travel to a new place I like visiting companies there.

Here are some the questions I always ask

  • How does it feel like working there?
  • How would you describe the company culture?
  • What are the core values?
  • Do you have Friday happy hours, friendly get-togethers?
  • How does a typical day look like?
  • Do people enjoy working there?
  • Is the company growing fast? How does it affect the company culture?
  • What about competition?

Do you have answers for all?

Friday, May 18, 2012

Best quotes from the Valve handbook

Valve is not a traditional software company, here is their handbook that new employees get on the first day.

Here are favorite quotes from the handbook.

Why does your desk have wheels? Think of those wheels as a symbolic reminder that you should always be considering where you could move yourself to be more valuable. But also think of those wheels as literal wheels, because that’s what they are, and you’ll be able to actually move your desk with them. You’ll notice people moving frequently; often whole teams will move their desks to be closer to each other. There is no organizational structure keeping you from being in close proximity to the people who you’d help or be helped by most.

Team leads, often, someone will emerge as the “lead” for a project. This person’s role is not a traditional managerial one. Most often, they’re primarily a clearinghouse of information. They’re keeping the whole project in their head at once so that people can use them as a resource to check decisions against. The leads serve the team, while acting as centers for the teams.

Hours, ... for the most part working overtime for extended periods indicates a fundamental failure in planning or communication. If this happens at Valve, it’s a sign that something needs to be reevaluated and corrected.

Even expensive mistakes, or ones which result in a very public failure, are genuinely looked at as opportunities to learn.

Working a lot of hours is generally not related to productivity and, after a certain point, indicates inefficiency. It is more valuable if you are able to maintain a sensible work/life balance and use your time in the office effi- ciently, rather than working around the clock.

We believe that high-performance people are generally self-improving.

The most successful people at Valve are both
(1) highly skilled at a broad set of things and
(2) world-class experts within a more narrow discipline. Because of the talent diversity here at Valve, it’s often easier to become stronger at things that aren’t your core skill set.

Hiring well is the most important thing in the universe. Nothing else comes close. It’s more important than breath- ing.

We value “T-shaped” people. That is, people who are both generalists (highly skilled at a broad set of valuable things—the top of the T) and also experts (among the best in their field within a narrow disci- pline—the vertical leg of the T).

An expert who is too narrow has difficulty collaborating. A generalist who doesn’t go deep enough in a single area ends up on the margins, not really contributing as an individual.

Sometimes, the philosophy and methods outlined in this book don’t match perfectly with how things are going day to day. But we’re confident that even when problems persist for a while, Valve roots them out.

Methods to find out what's going on at your company

I borrowed it from Valve's handbook.

Amazon S3 and 'Resource interpreted as Stylesheet but transferred with MIME type binary/octet-stream'

If you use Amazon S3 to serve your static CSS you may end up with this error message 'Resource interpreted as Stylesheet but transferred with MIME type binary/octet-stream'
  1. You have to log in into Amazon S3 console
  2. Navigate to the file in question
  3. Open Properties and click to the Metadata
  4. You can see a Content-Type field with the value binary/octet-stream, change it to text/css
Something like this

Thursday, May 3, 2012

Tina Seelig's Innovation Engine

I borrowed this concept from Tina Seelig’s terrific book, inGenius: A Crash Course in Creativity.

Here is the Innovation Engine.
On the inside of your Innovation Engine are knowledge, imagination, and attitude.
  • Your knowledge provides the fuel for your imagination.
  • Your imagination is the catalyst for the transformation of knowledge into new ideas.
  • Your attitude is a spark that sets the Innovation Engine in motion.
On the outside of your Innovation Engine are resources, habitat, and culture.
  • Resources are all the assets in your community.
  • Habitats are your local environments, including your home, school, or office.
  • Culture is the collective beliefs, values, and behaviors in your community.

Wednesday, May 2, 2012

Reload the Active Tab in Chrome with AppleScript

This is a revisited/simplified version of this old post.

You can get more scripts like this from Saekiさん's post

Tuesday, May 1, 2012

Git diff stash

If you need to see what's been changed for a certain stash, you can simply pass in the treeish for the stash.

Sunday, April 29, 2012

What makes a pragmatic programmer

Here are some of my notes of the book

What makes a pragmatic programmer

  • Early adopter/fast adapter
  • Inquisitive, tend to ask questions
  • Critical thinker
  • Realistic, try to understand the underlying nature of each problem you face
  • Jack of all trades, familiar with a broad range of technologies
Care about your craft. Think! About your work. Always trying to place it in its larger context, always trying to be aware of the bigger picture.

The cat ate my source code

Take responsibility for everything they do. We can be proud of our abilities, but we must be honest about our shortcomings. Provide options, don't make lame excuses. Don't be afraid to ask, or to admit that you need help.

Software entropy

Don't leave "broken windows" (bad designs, wrong decisions, or poor code) unrepaired. Take some action to prevent further damage and to show you're on top of the situation.

Stone soup and boiled frogs

Be a catalyst for change

Good enough software

If you give your users something to play with early, their feedback will often lead you to a better eventual solution.

Your knowledge portfolio

Invest regularly in your knowledge portfolio It's important to continue investing. Once you feel comfortable with some new language or bit of technology, move on. Learn another one. The process of learning will expand your thinking, opening you to new possibilities and new ways of doing things. Critically analyze what you read and hear.

Friday, March 2, 2012

E575: viminfo: Illegal starting char in line

When you start vim/vi and get the this error message it means that your ~/.viminfo file is corrupted.

The .viminfo is a history file for vim/vi so deleting it cannot cause any problem.

After deleting it vim/vi starts without any problem.

Monday, February 27, 2012

Downloading Google Search History

You can use bookmarklets like
Geeklad's script

or you can do it manually with by entering the following into your browser

Saturday, February 11, 2012

Changing the escape/command character in GNU Screen

Using API with NodeJS has a pretty good and straightforward API.

The following snippet fetches the top palettes with the help of NodeJS

Monday, January 30, 2012

Customizing The Mongodb Interactive Shell

When the shell is launched, it checks the user's home directory for a javascript file named .mongorc.js.
If this file is found, its contents are interpreted and run by the shell prior to displaying the prompt for the first time.
This allows the user to define variables, customize the prompt, or update information that they would like updated every time they launch a shell.

Here is my .mongorc.js

Tuesday, January 24, 2012

Show file history in git

There are two amazing tools to show a history of a file in git.

gitk /path/of/file
tig /path/of/file

Saturday, January 21, 2012

Google Chrome 'Confirm to Quit' on Lion

To avoid accidentally closing the browser, executing this line in Terminal makes Google Chrome require
Shift + Cmd + Q to quit.

Thursday, January 19, 2012

localStorage in iOS5 Private Browsing mode

Attempting to use localStorage.setItem in iOS5 Private Browsing mode will throw the exception


But getItem and removeItem calls do not throw.

You can see some details about that in the jStorage discussion

Monday, January 16, 2012

Font smoothing on Webkit

I’m not a big fan of the default text rendering in WebKit, it looks heavy. Fortunately there is a solution.

You can find here more examples on Christoph Zillgen's site.

Friday, January 6, 2012

Sluggish scroll in MacVim

There can be several reasons for sluggish scroll.
For me setting up 'ttyfast' solved the problem.

Delete all trailing whitespace in VIM

You can find more information about VIM and whitespaces here

Remove app from sale in iTunes Connect

It is not trivial.

1. Select your app

2. Click on Rights and Pricing

3. There is a link 'Unless you select specific stores, your app will be for sale in all App Stores worldwide.', click on the 'specific stores'

4. Deselect all locations

5. Save

Now, after removing the app form sale, you can remove it.