Skip to content

Instantly share code, notes, and snippets.

View Kikobeats's full-sized avatar
👋
say hi

Kiko Beats Kikobeats

👋
say hi
View GitHub Profile
@Kikobeats
Kikobeats / gulpfile.coffee
Last active August 29, 2015 14:11
Gulp browserify task
'use strict'
gulp = require 'gulp'
gutil = require 'gulp-util'
browserify = require 'browserify'
header = require 'gulp-header'
uglify = require 'gulp-uglify'
pkg = require './package.json'
source = require 'vinyl-source-stream'
@Kikobeats
Kikobeats / index.js
Last active August 29, 2015 14:15
inject responses sails
/**
* Module dependencies
*/
'use strict';
var buildDictionary = require('sails-build-dictionary');
module.exports = function Responses(sails) {
return {
loadResponses: function(cb) {
@Kikobeats
Kikobeats / gist:9143b69d8f4963a87252
Created February 12, 2015 08:21
finder freeze when select .DS_Store, *.torrent, *.mobi,...
12/02/2015 08:54:27.693 Finder[1474]: !!! _NSGlyphTreeInsertGlyphs glyph index issue 2
12/02/2015 08:54:27.693 Finder[1474]: !!! _NSGlyphTreeInsertGlyphs glyph index issue 2
12/02/2015 08:54:27.693 Finder[1474]: !!! _NSGlyphTreeInsertGlyphs glyph index issue 2
12/02/2015 08:54:27.694 Finder[1474]: !!! _NSGlyphTreeInsertGlyphs glyph index issue 2
12/02/2015 08:54:27.694 Finder[1474]: !!! _NSGlyphTreeInsertGlyphs glyph index issue 2
12/02/2015 08:54:27.694 Finder[1474]: !!! _NSGlyphTreeInsertGlyphs glyph index issue 2
12/02/2015 08:54:27.694 Finder[1474]: !!! _NSGlyphTreeInsertGlyphs glyph index issue 2
12/02/2015 08:54:27.694 Finder[1474]: !!! _NSGlyphTreeInsertGlyphs glyph index issue 2
12/02/2015 08:54:27.694 Finder[1474]: !!! _NSGlyphTreeInsertGlyphs glyph index issue 2
12/02/2015 08:54:27.694 Finder[1474]: !!! _NSGlyphTreeInsertGlyphs glyph index issue 2
@Kikobeats
Kikobeats / cluterize.js
Created October 23, 2015 10:13
Clusterize whatever node file
'use strict';
var path = require('path');
var workerFarm = require('worker-farm');
var numCPUs = require('os').cpus().length;
var argv = require('optimist')
.alias('n', 'cores')
.default('n', numCPUs)
.alias('w', 'workers')
@Kikobeats
Kikobeats / readable-pattern.js
Last active March 17, 2016 12:28
Pattern to create a Readable Stream
// Example based in Substack Stream Handbook:
// https://github.com/substack/stream-handbook#creating-a-readable-stream
'use strict'
var inherits = require('inherits')
var duplexify = require('duplexify')
var Stream = require('readable-stream').Stream
var CONST = {
@Kikobeats
Kikobeats / index.js
Last active January 27, 2016 08:25
async stream
var count = 0
function asyncFn (cb) {
setTimeout(function () {
console.log('emit new chunk')
return cb(null, {foo: 'bar'})
}, 500)
}
module.exports = function () {
{
"app": "YOUR_APP_NAME",
"cred": {
"appid": "YOUR_APP_ID",
"apikey": "YOUR_APP_KEY"
},
"oldentries": 86400000,
"index": {
"name": "YOUR_INDEX_NAME",
"settings": {
@Kikobeats
Kikobeats / index.js
Last active July 10, 2023 16:21
ES6 Pure & self documented Functions.
/**
* ES6 Pure & self documented Functions.
*
* Why Pure?
*
* A pure function is a function where the return value is only determined
* by its input values, without observable side effects.
*
* Why Self-documented?
*
@Kikobeats
Kikobeats / bench.js
Created January 2, 2017 22:45
hyperdiff
'use strict'
const _simpleArrayDiff = require('simple-array-diff')
const { map, range, random } = require('lodash')
const suite = require('fastbench')
const _hyperDiff = require('.')
const _range = range(0, 1000)
function generateRange (_range) {
return map(_range, () => { return { id: random(0, 100) } })
}
var utf8 = require('utf8');
var val1 = utf8.decode('\xE2\x80\x99');
const StringDecoder = require('string_decoder').StringDecoder;
const decoder = new StringDecoder('utf8');
const symbol = new Buffer([0xE2, 0x80, 0x99]);
const val2 = decoder.write(symbol);
console.log(val1);