Skip to content

Instantly share code, notes, and snippets.

View gabmontes's full-sized avatar

Gabriel Montes gabmontes

View GitHub Profile
@gabmontes
gabmontes / slackbot-github-pr.js
Last active December 17, 2016 22:38
Slack bot that listens for GitHub's PR URLs and finds out if the PR was merged or not
const SlackBot = require('slackbots')
const GitHubApi = require('github')
const github = new GitHubApi({
version: '3.0.0',
protocol: 'https'
})
const bot = new SlackBot({
token: 'xoxb-000000000000-aaaaaaaaaaaaaaaaaaaaaaaa',
@gabmontes
gabmontes / btc-balance.js
Last active November 28, 2016 15:30
Sum up the balances of a group of bitcoin addresses
const { Insight } = require('bitcore-explorers')
const promisify = require('tiny-promisify')
const addresses = [
/* bitcoin addresses here! */
]
const insight = new Insight()
const getUnspentUtxosAsync = promisify(insight.getUnspentUtxos.bind(insight))
@gabmontes
gabmontes / not-react.js
Created November 16, 2016 15:27
A minimal (re)implementation of ReactDOM for learning and teaching purposes.
/**
* not-react
*
* A minimal (re)implementation of ReactDOM for learning and teaching purposes.
*
* https://medium.com/@gab_montes/react-in-200-bytes-28156e714165
*/
// eslint-disable-next-line no-extra-semi
;(function (global) {
@gabmontes
gabmontes / my-top-starred-repos.js
Last active May 28, 2018 03:03
Automagically obtain your top starred repos as an Markdow table
const GitHubApi = require('@octokit/rest');
function pick(props) {
return function (object) {
const result = {}
Object.keys(object).filter(prop => props.includes(prop)).forEach(function (prop) {
result[prop] = object[prop]
})
return result
}
@gabmontes
gabmontes / not-jquery.js
Last active November 16, 2016 15:23
A partial (re)implementation of jQuery API as a polyfill for learning and teaching purposes
/**
* not-jquery
*
* A partial (re)implementation of jQuery API as a polyfill for learning and
* teaching purposes.
*
* https://gist.github.com/gabmontes/535a7b3b059b2a301a55b43e90ee0101
*/
// eslint-disable-next-line no-extra-semi
@gabmontes
gabmontes / babel-presets-transforms-matrix.md
Created October 19, 2016 15:41
Summary of babel presets to transforms matrix

Presets to transforms

Data as of 18-oct-2016

| es2015 | es2016 | es2017 | latest | latest-minimal(*) | stage-3 | stage-2 | stage-1 | stage-0 --- |:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---: check-es2015-constants | x | | | x | x | | | | syntax-dynamic-import | | | | | | | x | | syntax-trailing-function-commas | | | x | x | x | x | | | transform-async-generator-functions | | | | | | x | | |

const config = {
client: 'pg',
connection: {
host: 'localhost',
port: 5432,
user: 'user',
password: 'pass',
database: 'test'
},
debug: false
@gabmontes
gabmontes / test-bookshelf-paranoia.js
Created June 9, 2016 18:37
Test file to reproduce an issue with polymorphic relationships and soft deletes using bookshelf and bookshelf-paranoia
const config = {
client: 'pg',
connection: {
host : 'localhost',
port : 5432,
user : 'user',
password : 'pass',
database : 'test'
}
}
@gabmontes
gabmontes / index.js
Created May 9, 2016 15:11
Gists cleaner
var async = require('async');
var GitHubApi = require('github');
var github = new GitHubApi({
version: '3.0.0',
protocol: 'https'
});
github.authenticate({
type: 'basic',
@gabmontes
gabmontes / delete-all-my-gists.js
Last active December 3, 2023 08:39
Delete all your gists
var async = require('async');
var GitHubApi = require('github');
var github = new GitHubApi({
version: '3.0.0',
protocol: 'https'
});
github.authenticate({
type: 'basic',