Skip to content

Instantly share code, notes, and snippets.

View Adriem's full-sized avatar
:shipit:
Making javascripts

Adrián Moreno Adriem

:shipit:
Making javascripts
View GitHub Profile
@Adriem
Adriem / decorate-generator.js
Last active April 29, 2020 12:36
Enable decorating an asynchronous generator function in javascript
// When a generator function is decorated or composed, the composed function will not
// work unless the decorator explicitly supports decorating a generator function.
//
// This example shows how to wrap an async generator function as an async function, pass it
// to the decorators and wrap the result in an async generator synchronized with the original one.
const compose = (...functions) =>
functions.reverse().reduce((decorated, decorator) => decorator(decorated));
const decorateGeneratorFunction = (...decorators) => (generatorFunction) => {
@Adriem
Adriem / cloudSettings
Last active January 17, 2020 11:31
.vscode
{"lastUpload":"2020-01-17T11:31:19.183Z","extensionVersion":"v3.4.3"}
@Adriem
Adriem / milight.md
Created January 13, 2019 20:18 — forked from subdavis/milight.md

Setting up MiLight Wifi Bridge and LimitlessLED bulbs with Amazon Alexa and Home Automation Bridge

Goal of this tutorial

Be able to control MiLight bulbs with Amazon Alexa via the MiLight Wifi Bridge.

Materials

@Adriem
Adriem / update-hosts.js
Last active November 19, 2018 09:29
Simple script for updating the /etc/hosts file
#!/usr/bin/env node
/** @author Adrian Moreno (https://github.com/adriem) */
const https = require('https')
const fs = require('fs')
const urls = process.argv.slice(2).filter(arg => arg !== '-v' && arg !== '--verbose')
const verbose = process.argv.includes('-v') || process.argv.includes('--verbose')

Keybase proof

I hereby claim:

  • I am adriem on github.
  • I am morenadr (https://keybase.io/morenadr) on keybase.
  • I have a public key ASDxDhGhk_jYf_EUpnvR1SNBBPmy0l42CAEMQ4xbzvisDwo

To claim this, I am signing this object:

@Adriem
Adriem / .tmux.conf
Last active January 5, 2018 02:05
Tmux config
# ==============================================================================
# File: .tmux.conf
# Author: Adrian Moreno
# Repo: https://github.com/adriem/shell-utilities
# ==============================================================================
# Global settings
set -g default-terminal "screen-256color" # Enable 256 color terminal emulator
set -g status-interval 2 # Status bar refresh interval
set -g set-titles on # Set window title
@Adriem
Adriem / motd
Last active January 2, 2018 22:57
rpi-motd
# Copy this to /etc/motd
@Adriem
Adriem / .gitconfig
Last active December 20, 2018 10:54
Git aliases
[core]
eol = lf
autocrlf = input
safecrlf = false
pager = less
editor = /usr/bin/vim
[user]
email = _EMAIL_
name = _NAME_
@Adriem
Adriem / css-for-link-hints.css
Created October 25, 2017 10:26
Vimium settings
@Adriem
Adriem / snippets.md
Last active October 20, 2017 12:10
Debugging snippets

Some useful debugging snippets

Angular JS

Debugging ui-router

// Print each state transition
$rootScope.$on('$stateChangeSuccess', (_, toState) => console.log(`STATE CHANGED TO '${toState}'`));