Skip to content

Instantly share code, notes, and snippets.

View kristw's full-sized avatar

Krist Wongsuphasawat kristw

View GitHub Profile
@kristw
kristw / loading.html
Created December 13, 2013 02:31
Simple float loading component
<html>
<body>
<!-- Loading -->
<div class="loading-sign-wrap">
<div class="loading-sign">
<div class="loading-title">
loading
</div>
<img src="images/progress_bar.gif" alt="">
<div class="loading-subtitle">
@kristw
kristw / Package Control.sublime-settings
Last active January 3, 2016 07:49
Sublime Settings
{
"installed_packages":
[
"Alignment",
"Apache Pig",
"AutoFileName",
"BracketHighlighter",
"Color Schemes by carlcalderon",
"ColorPicker",
"DashDoc",
@kristw
kristw / filters.js
Last active August 29, 2015 13:56
Pattern for defining angularjs filter
define(['angular'], function (ng) {
'use strict';
return ng.module('app.filters', []);
});
@kristw
kristw / getPosition.js
Created May 15, 2014 22:25
Get element position on a screen
function getPosition(element) {
var xPosition = 0;
var yPosition = 0;
var topContainer;
while(element) {
xPosition += (element.offsetLeft - element.scrollLeft + element.clientLeft);
yPosition += (element.offsetTop - element.scrollTop + element.clientTop);
if(!element.offsetParent) topContainer = element;
element = element.offsetParent;
@kristw
kristw / .gitconfig
Last active September 2, 2020 17:54
git alias
; from this article http://haacked.com/archive/2014/07/28/github-flow-aliases/
[alias]
aa = add -A
co = checkout
ec = config --global -e
up = !git pull --rebase --prune $@ && git submodule update --init --recursive
cob = checkout -b
cm = !git add -A && git commit -m
save = !git add -A && git commit -m 'SAVEPOINT'
wip = !git add -u && git commit -m "WIP"
@kristw
kristw / smartDebounce.js
Last active August 29, 2015 14:11
Smart Debounce
// An improved version of the classic "debounce" function.
// var doSomething = debounce(fn);
// doSomething(params); will debounce.
// doSomething.now(params) will execute immediately.
//---------------------------------------------------
// Modified from lodash's debounce
//---------------------------------------------------
/**
@kristw
kristw / dropboxSublime.sh
Last active October 24, 2022 11:11
Sync Sublime Text 3 settings
# If you are working in multiple computers, you might want to keep and apply the same Settings for SublimeText across these computers.
# We can set this up with the help of Dropbox (and a small tweak).
# Credit: http://www.hongkiat.com/blog/sublime-text-tips/
# First, run the following command in Terminal.
DROPBOX_PATH=$HOME/Dropbox/settings/sublime-text-3/
mkdir -p $DROPBOX_PATH
mv "$HOME/Library/Application Support/Sublime Text 3/Packages" "$DROPBOX_PATH"
mv "$HOME/Library/Application Support/Sublime Text 3/Installed Packages" "$DROPBOX_PATH"
@kristw
kristw / index.html
Last active September 14, 2023 13:16
Thailand map
<!DOCTYPE html>
<meta charset="utf-8">
<style>
@import url(http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300|Josefin+Slab|Arvo|Lato|Vollkorn|Abril+Fatface|Old+Standard+TT|Droid+Sans|Lobster|Inconsolata|Montserrat|Playfair+Display|Karla|Alegreya|Libre+Baskerville|Merriweather|Lora|Archivo+Narrow|Neuton|Signika|Questrial|Fjalla+One|Bitter|Varela+Round);
.background {
fill: #eee;
pointer-events: all;
}
@kristw
kristw / fetal.json
Last active June 7, 2019 22:53
Fetal growth chart
[{"week":8,"length":1.6,"mass":1},
{"week":9,"length":2.3,"mass":2},
{"week":10,"length":3.1,"mass":4},
{"week":11,"length":4.1,"mass":7},
{"week":12,"length":5.4,"mass":14},
{"week":13,"length":7.4,"mass":23},
{"week":14,"length":8.7,"mass":43},
{"week":15,"length":10.1,"mass":70},
{"week":16,"length":11.6,"mass":100},
{"week":17,"length":13,"mass":140},
@kristw
kristw / index.html
Last active August 19, 2016 01:06
d3Kit.Skeleton
<!DOCTYPE html>
<html>
<head>
<title>d3Kit.Skeleton</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="chart"></div>