Skip to content

Instantly share code, notes, and snippets.

View attomos's full-sized avatar
💆‍♀️

Nattaphoom Chaipreecha attomos

💆‍♀️
View GitHub Profile
@attomos
attomos / ko.utils.signatures.js
Created January 12, 2018 08:24 — forked from hyle/ko.utils.signatures.js
KnockoutJS utils (ko.utils) signatures
// knockout 2.2.1
ko.utils.arrayFilter = function (array, predicate) { /* .. */ }
ko.utils.arrayFirst = function (array, predicate, predicateOwner) { /* .. */ }
ko.utils.arrayForEach = function (array, action) { /* .. */ }
ko.utils.arrayGetDistinctValues = function (array) { /* .. */ }
import pygal
from IPython.display import display, HTML
base_html = """
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://kozea.github.com/pygal.js/javascripts/svg.jquery.js"></script>
<script type="text/javascript" src="https://kozea.github.io/pygal.js/2.0.x/pygal-tooltips.min.js""></script>
</head>
@attomos
attomos / latency.txt
Created February 11, 2017 13:12 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@attomos
attomos / git-branches-by-commit-date.sh
Created January 20, 2017 03:03 — forked from jasonrudolph/git-branches-by-commit-date.sh
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
@attomos
attomos / sublime_text_2_useful_shortcuts.md
Created March 16, 2016 03:00 — forked from nuxlli/sublime_text_2_useful_shortcuts.md
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 - Useful Shortcuts

Tested in Mac OS X: super == command

Open/Goto


  • super+t: go to file
  • super+ctrl+p: go to project
  • super+r: go to methods
@attomos
attomos / destructuring.js
Created February 22, 2016 07:10 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring.
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => {
return [1, 2, 3];
@attomos
attomos / Q.js Examples
Created February 15, 2016 14:11 — forked from guptag/Q.js Examples
Q.js examples - Small snippets to understand various api methods in Q.js
//To run Q.js examples:
// 1. Open a new browser tab in Chrome and turn on developer toolbar.
// 2. Copy/Paste this gist in the console (opened from any http site) and hit enter to run the snippets.
// Based on the inspiration from samples @ https://github.com/kriskowal/q
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
@attomos
attomos / tmux.cheat
Last active December 15, 2015 14:13 — forked from afair/tmux.cheat
Tmux Quick Reference & Cheat sheet - 2 column format for less scrolling!
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^a w
New -s <session> Create ^a c
Attach att -t <session> Rename ^a , <name>
Rename rename-session -t <old> <new> Last ^a l (lower-L)
Kill kill-session -t <session> Close ^a &
@attomos
attomos / irc.md
Created December 6, 2015 08:54 — forked from xero/irc.md
irc cheat sheet

#IRC Reference

Not intended as a guide for newbies, more like a "cheat sheet" for the somewhat experienced IRC user, especially one who wields some power over a channel.

##The Basics

  • /join #channel
    • Joins the specified channel.
  • /part #channel
    • Leaves the specified channel.
@attomos
attomos / GitForWindowsSetup.md
Last active August 29, 2015 14:27 — forked from dmangiarelli/GitForWindowsSetup.md
How to setup Git for Windows

How to setup Git for Windows

I know this document seems long, but it shouldn't be too difficult to follow. This guide is based on Windows, but every program here have Linux/Mac equivalents, and in most cases they're built-in. So, take a deep breath and go step by step.

The steps below are for [GitHub][github], but the steps are almost idential for Bitbucket, Heroku, etc.

Cmder

The first thing you'll want to do is to download and install [Cmder][cmder], which is a terminal program that serves as excellent replacement for the built-in cmd.exe. It's not a shell itself, so it supports running plain old cmd.exe commands and running PowerShell.