This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on alfred_script(q) | |
tell application "Finder" | |
set pathList to (quoted form of POSIX path of (folder of the front window as alias)) | |
set command to "clear; cd " & pathList | |
end tell | |
tell application "System Events" | |
-- some versions might identify as "iTerm2" instead of "iTerm" | |
set isRunning to (exists (processes where name is "iTerm")) or (exists (processes where name is "iTerm2")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function(window) { | |
'use strict'; | |
var isArray = Array.isArray, | |
isObject = function(value) { | |
return value !== null && typeof value === 'object'; | |
}, | |
each = function(map, iterator) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const sliceArgs = function(args, beginIndex, endIndex) { | |
return Array.prototype.slice.call(args, beginIndex, endIndex); | |
}; | |
const _ = Symbol('placeholder'); | |
function partial(fn) { | |
let _args = sliceArgs(arguments, 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pipe() { | |
let funcs = arguments; | |
return function() { | |
let length = funcs.length; | |
let index = 0; | |
let result; | |
while (index < length) { | |
let fn = funcs[index]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const slice = Array.prototype.slice; | |
const toString = Object.prototype.toString; | |
function isObject(value) { | |
return value !== null && typeof value === 'object'; | |
} | |
function clone(value, deep) { | |
if (isObject(value)) { | |
let copy; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isArray = Array.isArray; | |
const toString = Object.prototype.toString; | |
function isDate(value) { | |
return toString.call(value) === '[object Date]'; | |
} | |
function isRegExp(value) { | |
return toString.call(value) === '[object RegExp]'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isArray = Array.isArray; | |
const slice = Array.prototype.slice; | |
const toString = Object.prototype.toString; | |
function isObject(value) { | |
return value !== null && typeof value === 'object'; | |
} | |
function isDate(value) { | |
return toString.call(value) === '[object Date]'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @jsx tag */ | |
function tag(type, props, ...children) { | |
return {type, props, children}; | |
} | |
function createElement(node) { | |
if (typeof node === 'string') { | |
return document.createTextNode(node); | |
} else { | |
let $root = document.createElement(node.type); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path') | |
var context = path.dirname(module.parent.filename) | |
// only for relative path uri | |
module.exports = function (uri) { | |
var filename = path.resolve(context, uri) | |
var cachedModule = getCachedModule(filename) | |
if (cachedModule) { | |
cleanModulesCache(cachedModule) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function merge () { | |
var args = [].slice.call(arguments) | |
var obj = {} | |
args.forEach(function (arg) { | |
if (typeof arg === 'object' && arg) { | |
for (var k in arg) { | |
obj[k] = arg[k] | |
} | |
} | |
}) |