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 Porter = require('@cara/porter'); | |
const porter = new Porter({ | |
paths: '.', | |
entries: 'examples/index.js', | |
}); | |
(async function() { | |
await porter.ready; | |
const packages = []; | |
for (const pkg of porter.package.all) { |
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
/* | |
* EventEmitter from seajs | |
*/ | |
var EventEmitter = { | |
// Bind event | |
on: function(name, callback) { | |
var events = this.events | |
var list = events[name] || (events[name] = []) | |
list.push(callback) | |
return this |
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
http://srd.simba.taobao.com/rd?w=mmp4ptest&f=http%3A%2F%2Fre.ai.taobao.com%2Fauction%3Fkeyword%3D%25D3%25BE%25BE%25B5%26catid%3D50016744%26refpid%3Dtt_16143929_2253494_8923336%26digest%3D14FFF3C95FDA79ECFD67C9BA19A9D3FB%26crtid%3D253374519%26itemid%3D25806828678%26adgrid%3D235827263%26elemtid%3D1%26eurl%3Dhttp%253A%252F%252Fclick.simba.taobao.com%252Fcc_im%253Fp%253D%2526s%253D1799020187%2526k%253D352%2526e%253DQCZhRciE%25252FhTsxQVKHpFcmpc5YPYV6uFQprYu2z%25252F1K7zCYH%25252FUB1Nb7s%25252BBGq5aFChlq6RTjAgq%25252BzWlQHM0vuyxD9%25252Bf1Nn8M%25252BvaGRAspkN7yHcUDirHF4jO%25252BsAhcUsRUe7pU4Okciyvb8MIkcj9FYsTf1pHY46HLYgaAoxpU5IeHihh2hk%25252B0boTXJlmrsgRDZ%25252FIqyGUPVFVApkLrWUZFICO%25252F3RGbeo%25252FYMH51brGK2Aeohvd51nD6zvbfr9%25252Fmf3ATTyoOAVfDfrjX%25252FLA%25252FjjO5m71GBPYPt1who2n2nhdyq4uw94YXnHDMXiHba2kmgyMwxYKqyGUPVFVApkLrWUZFICO%25252FwwyPNmHIw4z%26clk1info%3D1799020187%2C64%2CyCPeEAXW8cjNluokAwCJS3%252BwNv5tQ%252B2sCH23yplrNbwKBDDBuPY%252Fb9qBmJSKUspq%26sbid%3D1059%2C0%2C4%3B%3B%2C&k=a5181f062a3ad5fc&pv |
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
#!/usr/bin/env node | |
'use strict'; | |
/* jshint asi: true */ | |
var fs = require('fs') | |
var path = require('path') | |
var spawn = require('child_process').spawn |
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
// 基于 Promise 的分批函数 | |
// 遇到文件句柄不够用、并发请求数限制等场景的时候挺方便的 | |
function batch(arr, size, fn) { | |
var offset = 0 | |
var length = arr.length | |
var limit = size | |
function _batch(offset, limit) { | |
return Promise.all(arr.slice(offset, limit).map(fn)).then(function() { | |
if (limit <= length) { |
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 util = require('util') | |
function Class() {} | |
function SubClass() {} | |
function WrongSubClass() {} | |
util.inherits(SubClass, Class) | |
util.inherits(WrongSubClass, Class) |
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 multiply() { | |
// implementation code goes here | |
} | |
multiply(3)(4)(5) // ==> 60 |
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 data = [{ | |
sizes: [1, 0] | |
},{ | |
sizes: [2, 3] | |
},{ | |
sizes: [2, 2] | |
},{ | |
sizes: [3, 5] | |
},{ | |
sizes: [1, 0] |
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
# How to create a favicon with multiple image sizes and keep alpha transparency | |
- export your images in the desired sizes (16x16, 32x32 ... max 256x256) as PNGs + alpha | |
- install ImageMagick | |
Run this command (replacing the .png files for your own images): | |
convert favicon-16.png favicon-32.png favicon-64.png -colors 256 -alpha background favicon.ico |
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
$ sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ Mavericks.app --nointeraction |
NewerOlder