Skip to content

Instantly share code, notes, and snippets.

View vshjxyz's full-sized avatar
🌀

Luca Del Bianco vshjxyz

🌀
View GitHub Profile
@vshjxyz
vshjxyz / Gemfile
Last active October 25, 2017 13:35 — forked from chillu/Gemfile
Batch update labels in Github repos
gem "octokit", "~> 4.0"
@vshjxyz
vshjxyz / transformers.ts
Created September 8, 2017 08:26
Mutator-io transformer example
mutator.transform('myPipeName', msg => `${msg} my transformation` as TransformStream)
mutator.transform('myPipeName', msg => Promise.resolve(`${msg} my transformation promise`) as TransformStream)
mutator.transform('myPipeName', msg => Observable.of(`${msg} my transformation observable`) as TransformStream)
@vshjxyz
vshjxyz / pipe.ts
Last active September 8, 2017 08:25
Mutator-io pipe example
import { Observable } from 'rxjs'
import {
MutatorIO,
InputStream,
OutputStream
} from 'mutator-io'
const myPipe = {
name: 'myPipeName',
in: {
create: () => Observable.of('My message', 'My other message')
@vshjxyz
vshjxyz / example.js
Created December 20, 2016 17:49
DynamoDB JS FilterExpression with IN clause
function generateParametersList (name = '', params) {
return _.chain(params)
.uniq()
.map((param, i) => ({ [`:${name}${i}`]: param }))
.reduce((acc, curr) => ({ ...acc, ...curr }))
.value()
}
const typesMapping = generateParametersList('type', types)
const input = [[1,2,[3]],4];
const output = [1,2,3,4];
function *flatten(arr) {
for (value of arr) {
if (Array.isArray(value)) {
yield *flatten(value);
} else {
yield value;
}
### Keybase proof
I hereby claim:
* I am vshjxyz on github.
* I am delbianco (https://keybase.io/delbianco) on keybase.
* I have a public key whose fingerprint is 0058 0111 18B8 C588 2A4A C699 87E9 D63E F220 B01A
To claim this, I am signing this object:
const handler = (request, response) => response('Hello, World!');
const routes = {
home: handler,
foo: {
bar: handler,
baz: handler,
qux: handler
},
ids: {
1: handler,
@vshjxyz
vshjxyz / Fibonacci ES6.js
Created November 12, 2015 12:50
just a test function to see how recursive generators works in ES6
function *fib(iterations=10, val1=0, val2=1) {
if (iterations > 0) {
let sum = val1 + val2;
yield sum;
yield *fib(iterations - 1, val2, sum);
}
}
[...fib()].map((val) => console.log(val));
# Path to your oh-my-zsh installation.
export ZSH=/Users/developer/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="gianu"
# Uncomment the following line to use case-sensitive completion.
@vshjxyz
vshjxyz / getJSON.coffee
Created January 31, 2014 10:53
Node.js examples
http = require "http"
https = require "https"
###
getJSON: REST get request returning JSON object(s)
@param options: http options object
@param callback: callback to pass the results JSON object(s) back
###
exports.getJSON = (options, onResult) ->
console.log "---> #{options.method} ~ #{options.host}:#{options.port}#{options.path}"