Skip to content

Instantly share code, notes, and snippets.

View legend80s's full-sized avatar
🎯
Focusing

legend80s

🎯
Focusing
  • Alibaba
  • Beijing
View GitHub Profile
@jaretburkett
jaretburkett / parallelSync.js
Created April 23, 2018 23:23
Parallel synchronous functions with a common resolve in Node.js
function parallelSync(arrOfSyncFunctions){
return new Promise(async resolve =>{
let numToResolve = arrOfSyncFunctions.length;
let numResolved = 0;
// call after each async function resolves
const resolveOne = () =>{
numResolved++;
if(numResolved >= numToResolve){
// all functions have resolved. Resolve finally
resolve();
@legend80s
legend80s / hot-server.js
Last active October 13, 2016 10:11
Brower reloads on file changed
/* eslint-disable no-console */
const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
const LogPlugin = require('./webpack-plugins/bundling-lifecycle-log-plugin');
const config = require('./webpack.config.js');
const WEB_PORT = 7002;
@tonyc726
tonyc726 / exchange.js
Created December 24, 2015 11:45
JS数字金额大写转换
var digitUppercase = function(n) {
var fraction = ['角', '分'];
var digit = [
'零', '壹', '贰', '叁', '肆',
'伍', '陆', '柒', '捌', '玖'
];
var unit = [
['元', '万', '亿'],
['', '拾', '佰', '仟']
];
@jrencz
jrencz / q-race.es6
Last active May 7, 2018 08:58
Quick attempt to add spec-compliant race method to Angular $q
(function () {
'use strict';
angular
.module('q.race', [])
.config(function ($provide) {
$provide.decorator('$q', function ($delegate) {
$delegate.race = promises => $delegate((resolve, reject) => {
const bind = promise => {
@iambibhas
iambibhas / scopes.txt
Last active June 16, 2024 20:45
Sublime Text 2: Snippet scopes
Here is a list of scopes to use in Sublime Text 2 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
CoffeeScript: source.coffee