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 / git_alias_sort_remote_branches
Created Mar 22, 2018
Git alias to sort remote branches based on last updated time desc
View git_alias_sort_remote_branches
blremotesorted = "!for branch in `git branch -r | grep -v HEAD`;do echo `git show --format=\"%ci %cr %an\" $branch | head -n 1` \t$branch; done | sort -r"
blremotesortedcsv = "!for branch in `git branch -r | grep -v HEAD`;do echo `git show --format=\"%ci,%cr,%an\" $branch | head -n 1`,$branch; done | sort -r"
View category-theory-for-programmers.md

Category: The Essence of Composition

Roughly, category theory is a general mathematical theory of structures and of systems of structures [[1]]. Generally, is best represented with Objects and Arrows that go between them.

A -> B -> C
A -> C

If there is an arrow from object A to object B, and another arrow from B

@npatmaja
npatmaja / vim-cheat-sheet.md
Last active Feb 15, 2017
My Vim Cheat Sheet
View vim-cheat-sheet.md

Vim Cheat Sheet Collection

Mode Command Description
NORMAL * Select all occurrences of word under cursor. Put the cursor to the desired word and pres * to search for the next occurrences of the word. Press n to go to the next occurrence
NORMAL n Go to the next occurrence of the searched term
NORMAL N Go to the previous occurrence of the searched term
@npatmaja
npatmaja / new_gist_file
Last active Sep 15, 2016
Upgrading packages in Ubuntu 16.04
View new_gist_file
# Show upgradable package
sudo apt list --upgradable
# Upgrade a package
sudo apt install --only-upgrade <package-name>
# Autoremove unused packages
sudo apt autoremove
@npatmaja
npatmaja / functional.js
Last active Aug 21, 2016
Functional JS
View functional.js
// Partial application
const sum = (a, b, c) => a + b + c;
const papply = (fn, ...rest) => (...last) => fn.apply(null, [...rest, ...last]);
const a = papply(sum, 5);
console.log(a(2, 3));
// currying
const curry = (fn, ...rest) => {
@npatmaja
npatmaja / deploy
Last active Dec 26, 2015
Setup Hugo deployment to Github pages without using subtree
View deploy
#!/usr/bin/env bash
# change into the script's directory
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pushd $DIR > /dev/null
# configuration
OUT=out
TMP=tmp
@npatmaja
npatmaja / async-propagate-callback.js
Created May 5, 2015
propagate async callback usefull when using async.waterfall with mongoose
View async-propagate-callback.js
// to propagate async callback
// usefull when using async.waterfall
// with mongoose
async.waterfall([
task1(),
task2(),
task3()
], callFinalCallback());
@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)"
@npatmaja
npatmaja / readme.md
Last active Aug 29, 2015
Use underscore js inside Jade, unescape attribute content
View readme.md
You can’t perform that action at this time.