Skip to content

Instantly share code, notes, and snippets.

@takashi
takashi / sublime-keymap
Created January 16, 2013 12:42
sublime-keybinding
[
// how to move in the filer with hjkl
{ "keys": ["j"], "command": "move", "args": {"by": "lines", "forward": true}, "context":
[ {"key": "control", "operand": "sidebar_tree"} ]
},
{ "keys": ["k"], "command": "move", "args": {"by": "lines", "forward": false}, "context":
[ {"key": "control", "operand": "sidebar_tree"} ]
},
{ "keys": ["l"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
[ {"key": "control", "operand": "sidebar_tree"} ]
@takashi
takashi / Preferences.sublime-settings
Created October 16, 2013 10:14
sublime-settings
{
"color_scheme": "Packages/Theme - Flatland/Flatland Monokai.tmTheme",
"draw_indent_guides": true,
"figlet_font": "big",
"flatland_gray_selected_sidebar": true,
"flatland_square_tabs": true,
"font_face": "M+ 1m light",
"font_size": 11,
"highlight_modified_tabs": true,
"ignored_packages":
// INPUT
%reset-padding
padding: 0
%reset-margin
margin: 0
%container
@extend %reset-padding
@extend %reset-margin
@takashi
takashi / timer.js
Created December 4, 2013 09:19
timer that works in web worker
var Timer = function() {
onmessage = this.switchCase.bind(this);
this.currentTime = 0;
this.timerId = 0;
};
p = Timer.prototype;
p.switchCase = function(e) {
switch(e.data) {
@takashi
takashi / repeatend.js
Last active August 29, 2015 13:56
angular repeat-end directive
'use strict';
/**
* Notify when the ng-repeat is end.
* ex
* <li ng-repeat="item in items" repeat-end></li>
* And to know repeatend from other directive,
* the other directive should use scope.$on('repeatend', function() {});
*/
angular.module('ModuleName')
@takashi
takashi / method_missing.js
Created March 26, 2014 10:22
method missing in JavaScript
var HtmlElem = (function(){
'use strict';
var elemStartStr = "<",
elemGut = '</',
elemEndStr = ' >',
elemOmitedClosingTag = ' />',
idStr = ' id="',
classStr = ' class="',
hrefStr = ' href="',
srcStr = ' src="',
@takashi
takashi / hex.html
Created April 1, 2014 18:04
hex_box.html
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<div class="hex">
<a href="" class="hex_wrapper_link">
<div class="hex_parts hex_parts_60"></div>
@takashi
takashi / http_handler.go
Created April 9, 2014 08:54
a tour of go excercise: HTTP Handler
package main
import (
"fmt"
"net/http"
)
type String string
func (s String) ServeHTTP(w http.ResponseWriter, r *http.Request) {
@takashi
takashi / colorize.js
Created May 21, 2014 18:17
Get three characteristic colors in image(like itunes covers).
(function(global){
/**
* @constructor
*/
function Colorize(callback, opt_src) {
if (opt_src) {
this.image = document.createElement('image');
this.image.src = opt_src;
} else {
this.image = document.getElementById(Colorize.TARGET_ID);
@takashi
takashi / gulpfile.js
Created May 31, 2014 11:47
for static html page
var gulp = require('gulp'),
useref = require('gulp-useref'),
sass = require('gulp-ruby-sass'),
concat = require('gulp-concat'),
prefixer = require('gulp-autoprefixer'),
minify = require('gulp-minify-css'),
uglify = require('gulp-uglify'),
plumber = require('gulp-plumber'),
clean = require('gulp-clean'),
cache = require('gulp-cache'),