Skip to content

Instantly share code, notes, and snippets.

View amatiasq's full-sized avatar

A. Matías Quezada amatiasq

View GitHub Profile
@amatiasq
amatiasq / .eslintrc.json
Created August 24, 2016 09:40
ESLint config for es6-babel
{
"parser": "babel-eslint",
"env": {
"browser": true
},
"globals": {
"define": true,
"require": true,
{
"name": "nomes",
"version": "1.0.0",
"description": "",
"main": "index.html",
"devDependencies": {
"ts-loader": "^0.8.2",
"typescript": "^1.8.10"
},
"scripts": {
export interface IBar {
foo: boolean;
}
/* eslint-disable */
let indent = 1;
function log(Class) {
const descriptors = {};
Reflect.ownKeys(Class.prototype).forEach(key => {
const descriptor = Reflect.getOwnPropertyDescriptor(Class.prototype, key);
const {value} = descriptor;
descriptors[key] = descriptor;
interface IChainLink {
type: 'resource' | 'value';
value: string;
}
type SingleApiIndex<T> = { [p in keyof T]: SingleApi<T[p]>; };
type ApiIndex<T> = { [p in keyof T]: Api<T[p]>; };
interface BaseApi<T> {
class ReadableStream<T> {
// ...
debounce(milliseconds: number): ReadableStream<T[]>;
debounce<TOut>(milliseconds: number, join?: (list: T[]) => TOut): ReadableStream<TOut> {
let lastTime = Date.now();
let buffer: T[] = [];
return new ReadableStream<TOut>((push: (value: TOut) => void) => {
type myMethodSignature<T> = (value: T) => void;
class Test {
alias: myMethodSignature<T>;
constructor() {
this.alias = this.myMethod.bind(this);
}
myMethod<T>(value: T): void {}
@amatiasq
amatiasq / stringify.js
Created July 18, 2017 16:37
A custom JSON stringifier
function stringify(value, indent = '') {
const nextIndent = `${indent} `;
if (isNative(value))
return JSON.stringify(value);
if (Array.isArray(value)) {
if (value.length === 1 && isNative(value[0]))
return JSON.stringify(value);
@amatiasq
amatiasq / rif.sh
Created July 28, 2017 13:57
Run in folders
#!/usr/bin/env bash
cmd=$@;
for i in $(ls)
do
if [ -d "$i" ]
then
echo "Entering ./$i"
cd "$i"