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 / 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?
*
{
"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 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 () {
@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 / 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 / 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 / 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 / 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 / gist:bf0ee77573798628d7d7
Created October 28, 2014 16:18
async wit coffee
# 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 July 10, 2023 16:22
OSX Yosemite Gray – Alfred Theme
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