Skip to content

Instantly share code, notes, and snippets.

@kotarok
kotarok / mono.js
Last active January 18, 2016 12:52
Minimum fake jQuery
var $ = function(q, f){
return [][(f? 'forEach': 'slice')].call(document.querySelectorAll(q), f || 0);
};
@kotarok
kotarok / watchSwipe.js
Last active January 18, 2016 03:17
JavaScript watchSwipe() event observer.
var watchSwipe = function(el) {
var d = {};
var SWIPWE = 'swipe',
FLICK = 'flick',
DIRECTIONS = ['Up', 'Left', 'Right', 'Down'],
SWIPE_MIN_MOVE = 50,
FLICK_MIN_MOVE = 30,
FLICK_MIN_VELO = 1;
el.touchstartListener_ = function(e) {
@kotarok
kotarok / Parallax.js
Last active December 1, 2015 10:12
Simple and easy parallax effect.
/**
* Parallax class provides parallax effect for multiple elements.
* @constructor
*/
var Parallax = function(expr) {
this.targets = [];
if (typeof expr === 'string') {
this.init(expr);
}
};
@kotarok
kotarok / packages.cson
Created June 2, 2015 11:49
The list of ATOM packages I installed. Produced and used by https://atom.io/packages/package-sync package.
packages: [
"atom-beautify"
"autocomplete-paths"
"color-picker"
"comment"
"docblockr"
"emmet"
"file-icons"
"flatland-dark"
"flatland-dark-ui"
@kotarok
kotarok / private.xml
Last active August 29, 2015 14:20
Karabiner setting file for myself.
<?xml version="1.0"?>
<root>
<list>
<item>
<name>Kotarok custom setting</name>
<item>
<name>Kana with IJKL to cursor (and more)</name>
<!-- <appendix>EISUU/KANA to toggle them each other.</appendix> -->
<identifier>remap.kanaijklcursor</identifier>
<autogen>__KeyOverlaidModifier__ KeyCode::JIS_EISUU, KeyCode::OPTION_L, KeyCode::VK_JIS_TOGGLE_EISUU_KANA</autogen>
var ListShuffler = function(targetExpr, itemExpr) {
this.targetExpr = targetExpr || '';
this.itemExpr = itemExpr || 'li';
this.targetEl = {};
this.items = [];
this.init();
this.do();
}
ListShuffler.prototype.init = function() {
// Define custom color name.
$my-red: #ee3333;
$my-blue: #3333ee;
// Then assign thme to role or context based name variables.
$header-bg: $my-red;
$header-active-fg: $my-blue;
// Bind them to elements finally.
.header {
@kotarok
kotarok / 0_reuse_code.js
Created March 22, 2014 16:28
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@kotarok
kotarok / Default (OSX).sublime-keymap
Created January 23, 2013 08:56
Default (OSX).sublime-keymap
[
{ "keys": ["super+("], "command": "toggle_setting", "args": {"setting": "word_wrap"} }
]
{
"caret_style": "phase",
"color_scheme": "Packages/Color Scheme - Default/Espresso Soda.tmTheme",
"ensure_newline_at_eof_on_save": true,
"font_size": 13.0,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages":
[
"Vintage"