Skip to content

Instantly share code, notes, and snippets.

@cevek
cevek / index.js
Last active October 19, 2016 07:40
const esprima = require('esprima');
const recast = require('recast');
const fs = require('fs');
var acorn = require("acorn");
var escodegen = require("escodegen");
var babylon = require("babylon");
var cst = require("cst");
var browserify = require('browserify');
var b = browserify();
function isWhiteSpace(cp) {
return (cp === 0x20) || (cp === 0x09) || (cp === 0x0B) || (cp === 0x0C) || (cp === 0xA0) ||
(cp >= 0x1680 && [0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(cp) >= 0);
}
function isLineTerminator(cp) {
return (cp === 0x0A) || (cp === 0x0D) || (cp === 0x2028) || (cp === 0x2029);
}
// const globMap = new Uint8Array(256 * 256);
let packer: any;
let ts: any;
let autocss: any;
let autoprefixer: any;
let cssmin: any;
let jsmin: any;
let scss: any;
let cssmodules: any;
let grab: any;
let less: any;
import {
IGeneratorClass, currentDir, UpperCamelCase, lowerCamelCase, trimLines,
findGenTemplatesRoot
} from 'gen-templates';
import {relative} from 'path';
export default class Component implements IGeneratorClass {
help(){
return `
Creates something good
`;
@cevek
cevek / dao.ts
Last active September 29, 2016 17:04
interface FindParams {
attrs?: string;
sql?: string;
where?: any;
model?: DAO<any>;
include?: (DAO<any> | FindParams)[];
values?: any[],
orderBy?: string;
}
@cevek
cevek / Promise.ts
Last active September 23, 2016 16:00
type Opt<T> = T | undefined | void | null;
type Any = any;
type This = Any;
type Arg = Any;
type PDef = P<Any>;
type Callback<R, T> = Opt<(<R>(val: T, arg: Arg) => R | P<R>)>;
const enum PromiseState{
PENDING,
type Resolve<T> = (value?: T | PromiseLike<T> | undefined) => void;
type Reject = (reason?: any) => void;
type AbortFn = ((onCancel: () => void) => void) | undefined;
type Executor<T> = (resolve: Resolve<T>, reject: Reject, onCancel?: AbortFn) => void
export class CancellablePromise<T> implements Promise<T> {
cancelled = false;
children?: CancellablePromise<{}>[] = undefined;
promise: Promise<T>;
onCancel?: ()=>void;
parent: CancellablePromise<{}>;
type Resolve<T> = (value?: T | PromiseLike<T> | undefined) => void;
type Reject = (reason?: any) => void;
type AbortFn = ((onCancel: ()=>void)=>void) | undefined;
type OnFullfilled<T, TResult> = (value: T) => TResult | PromiseLike<TResult>;
type OnRejected<T, TResult> = (reason: any) => TResult | PromiseLike<TResult> | void;
type Executor<T> = (resolve: Resolve<T>, reject: Reject, onCancel?: AbortFn) => void
export class CancellablePromise<T>{
cancelled = false;
import './AnimatedNumber.scss';
export class AnimatedNumber extends zx.react.Component {
isAnimation = false;
duration = 1000;
oldValue = this.props.value;
oldRawValue = +this.props.rawValue || +this.props.value;
currentValue = this.props.value;
currentRawValue = +this.props.rawValue || +this.props.value;
nextValue;
ffprobe -show_frames -of compact=p=0 -f lavfi "movie=chappy.mkv,select=gt(scene\,.4)" > foo.txt