Skip to content

Instantly share code, notes, and snippets.

Avatar
👋

Kiko Beats Kikobeats

👋
View GitHub Profile
@Kikobeats
Kikobeats / index.js
Last active Sep 6, 2017
ES6 Pure & self documented Functions.
View index.js
/**
* 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?
*
View search.example.json
{
"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 Jan 27, 2016
async stream
View index.js
var count = 0
function asyncFn (cb) {
setTimeout(function () {
console.log('emit new chunk')
return cb(null, {foo: 'bar'})
}, 500)
}
module.exports = function () {
@Kikobeats
Kikobeats / readable-pattern.js
Last active Mar 17, 2016
Pattern to create a Readable Stream
View readable-pattern.js
// 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 / cluterize.js
Created Oct 23, 2015
Clusterize whatever node file
View cluterize.js
'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 / gist:9143b69d8f4963a87252
Created Feb 12, 2015
finder freeze when select .DS_Store, *.torrent, *.mobi,...
View gist:9143b69d8f4963a87252
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 / index.js
Last active Aug 29, 2015
inject responses sails
View index.js
/**
* Module dependencies
*/
'use strict';
var buildDictionary = require('sails-build-dictionary');
module.exports = function Responses(sails) {
return {
loadResponses: function(cb) {
@Kikobeats
Kikobeats / gulpfile.coffee
Last active Aug 29, 2015
Gulp browserify task
View gulpfile.coffee
'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'
View gist:bf0ee77573798628d7d7
# same code, with async
async = require 'async'
# all requests will be run in parallel
async.parallel [
(cb) -> $.get '/user/:id', cb
(cb) -> $.get '/country/:id', cb
(cb) -> $.get '/orders/:userId', cb
(cb) -> $.get '/relatedProducts/:userId', cb
], (err, results) ->
@Kikobeats
Kikobeats / gist:378ea3662b15aa5437be
Last active Aug 29, 2015
OSX Yosemite Gray – Alfred Theme
View gist:378ea3662b15aa5437be
alfred://theme/separatorColor=rgba(0,0,0,0.00)&searchSelectionForegroundColor=rgba(0,0,0,1.00)&searchForegroundColor=rgba(0,0,0,1.00)&resultSubtextFontSize=1&resultSelectedBackgroundColor=rgba(0,0,0,0.06)&shortcutColor=rgba(95,95,97,1.00)&scrollbarColor=rgba(0,0,0,0.10)&imageStyle=3&resultSubtextFont=Helvetica%20Neue%20Light&background=rgba(224,224,224,1.00)&shortcutFontSize=2&searchFontSize=3&resultSubtextColor=rgba(153,153,153,1.00)&searchBackgroundColor=rgba(24,22,20,0.00)&name=OSX%20Yosemite%20Gray&resultTextFontSize=2&resultSelectedSubtextColor=rgba(110,110,110,1.00)&shortcutSelectedColor=rgba(107,108,109,1.00)&widthSize=2&border=rgba(0,0,0,0.00)&resultTextFont=Helvetica%20Neue%20Light&resultTextColor=rgba(53,53,53,1.00)&cornerRoundness=3&searchFont=Helvetica%20Neue%20Light&searchSelectionBackgroundColor=rgba(178,215,255,1.00)&credits=Kiko%20Beats&searchPaddingSize=0&resultSelectedTextColor=rgba(0,0,0,1.00)&resultPaddingSize=2&shortcutFont=Helvetica%20Neue%20Light