Skip to content

Instantly share code, notes, and snippets.

Nauval Atmaja npatmaja

Block or report user

Report or block npatmaja

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@npatmaja
npatmaja / comment-mult-lines-vim.md
Created Jun 13, 2014
Comment multiple lines at a time in Vim
View comment-mult-lines-vim.md
  1. hit ctrl+v (visual block mode)
  2. use the down arrow keys to select the lines you want (it won't highlight everything)
  3. Shift+i (capital I)
  4. insert the text you want, i.e. '% '
  5. Press ESC

[taken from stackoverflow] (http://stackoverflow.com/a/15588798)

View nil-empty-blank.md

.nil?

  • It is Ruby method
  • It can be used on any object and is true if the object is nil.
  • "Only the object nil responds true to nil?" - RailsAPI
nil.nil? = true
anthing_else.nil? = false
a = nil
@npatmaja
npatmaja / 0_reuse_code.js
Created Aug 20, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View ruby-hash.md

Several ways to define a hash in ruby:

hash = { 
  :key1 => "value1",
  :key2 => "value2"
}

or with syntactic sugar:

@npatmaja
npatmaja / work_around.md
Created Aug 25, 2014
Work around of Errno::EPIPE: Broken pipe while inserting a file through google drive ruby api client
View work_around.md

Error found while inserting a file to Google Drive ruby API client:

Errno::EPIPE: Broken pipe
from /Users/nauval/.rbenv/versions/2.1.2/lib/ruby/2.1.0/openssl/buffering.rb:326:in `syswrite'

Work around: Tell the API client to use HTTPClient as Faraday's default adapter after the require google api

@npatmaja
npatmaja / new_gist_file.md
Last active Aug 29, 2015
Change tab size in Sublime Text2
View new_gist_file.md

There are two ways to change the default tab size in Sublime Text2:

  1. Go to Preferences -> Setting - Default and change the value of tab_size to whatever you want. In my case it was 2.

  2. Go to Preferences -> Setting - User and add lines below:

{
	"tab_size": 2,
	"translate_tabs_to_spaces": true
@npatmaja
npatmaja / readme.md
Last active Aug 29, 2015
Use underscore js inside Jade, unescape attribute content
View readme.md
@npatmaja
npatmaja / git-aliases.md
Last active Aug 29, 2015
Gist aliases in `~/.gitconfig`
View git-aliases.md
[alias]
	bl = branch -l
	co = checkout
	ec = config --global -e
	up = !git pull --rebase --prune $@ && git submodule update --init --recursive
	pushm = push origin master
	pullm = pull origin master
	pusho = !git push origin "$(git rev-parse --abbrev-ref HEAD)"
	pullo = !git pull origin "$(git rev-parse --abbrev-ref HEAD)"
You can’t perform that action at this time.