Skip to content

Instantly share code, notes, and snippets.

View nightink's full-sized avatar

Ink nightink

  • Alibaba
  • Knowhere
View GitHub Profile
@nightink
nightink / handlebars-eachobj.js
Last active December 22, 2015 08:48
handlebars.js -- Uncertain number of attributes object traversal
/**
* handlebars eachObj
* User: Nightink
* Date: 13-08-23
*/
define(function(require, exports, module) {
var handlebars = require('handlebars');
function isFunction(value) {
@nightink
nightink / underscore-each.js
Last active January 20, 2017 06:19
underscore each Simulation for loop 'continue' and 'break' keyword
/**
* underscore each Simulation for loop 'continue' and 'break' keyword
*/
var datas = [1, 2, 3, 4, 5, 6, 7];
_.each(datas, function(data, k) {
console.log(data, k);
if(k === 2) {
console.log('continue');
@nightink
nightink / errno.h
Created June 6, 2014 03:19
file open error
#define EPERM  1 /* Operation not permitted */
#define ENOENT 2 /* No such file or directory */
#define ESRCH 3 /* No such process */
#define EINTR 4 /* Interrupted system call */
#define EIO 5 /* Input/output error */
#define ENXIO 6 /* Device not configured */
#define E2BIG 7 /* Argument list too long */
#define ENOEXEC 8 /* Exec format error */
#define EBADF 9 /* Bad file descriptor */
#define ECHILD 10 /* No child processes */
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script type="application/javascript">
alert('msg');
</script>
@nightink
nightink / omit_vs_pick.js
Created May 26, 2016 02:45
omit vs pick
'use strict';
const Benchmark = require('benchmark');
const benchmarks = require('beautify-benchmark');
const suite = new Benchmark.Suite;
const Copy = require('copy-to');
/**
* omit keys in src
@nightink
nightink / machine.js
Created December 19, 2019 08:44
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@nightink
nightink / machine.js
Last active December 19, 2019 09:20
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@nightink
nightink / machine.js
Created December 23, 2019 03:21
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions