Skip to content

Instantly share code, notes, and snippets.

View beeant's full-sized avatar
🎯
Focusing

₿ryant Teja beeant

🎯
Focusing
View GitHub Profile
@beeant
beeant / gist:7131396
Last active December 26, 2015 09:39
re-map mouse to touch event and vice versa
(function () {
var MOVE_THRESHOLD = 20;
// 'tap'イベントをjQueryに登録
$.event.special.tap = {
setup: function() {
var self = $(this);
self.on('touchstart', function(e) {
var moved = false,
origTarget = e.target,
origEvent = e.originalEvent,
@beeant
beeant / cache locals
Created October 21, 2013 07:03
locals lazy loading
// always defined locals
res.locals.user = req.user;
// cached locals
if (req.xhr) { return next(); }
console.log(req.url);
/* ************ *
* Non XHR only
* ************ */
/*
use dot separated string as nested object path
and parse it to get the value
*/
// sample nested object:
var messages =
errors: {
username: {
validation: 'Username is invalid'
}
/* node getImages.js http://www.yahoo.co.jp */
var htmlparser = require('htmlparser');
var sys = require('sys');
var http = require('http');
var fs = require('fs');
var url = require('url');
var path = require('path');
if(process.argv.length !== 3){