Skip to content

Instantly share code, notes, and snippets.

View elycruz's full-sized avatar

Ely De La Cruz elycruz

View GitHub Profile
/**
* Created by elydelacruz on 11/8/16.
* Simple function to extract delimited content from a string.
*/
'use strict';
/**
* Returns whether our content has opening and closing delimiters.
* @param content {String}
@mzabriskie
mzabriskie / .gitignore
Last active July 17, 2017 16:21
Releasing ES6 node modules to npm
build/
node_modules/
@NV
NV / README.md
Created April 12, 2010 11:28
JavaScript Timer class. setInterval pool. Much more powerful than prototype.js's periodicalExecuter

JavaScript Timer

Run 5 times, with one second delay between calls

t1 = new Timer(500, function(){
  console.log(this.count);
  if (this.count >= 5) {
    this.stop();
  }

});

/*
Common vector operations
Author: Tudor Nita | cgrats.com
Version: 0.51
*/
function Vec2(x_,y_)
{
this.x = x_;
this.y = y_;
@PGBI
PGBI / .profile
Last active November 25, 2020 20:43
`vagrant halt all` command to halt all running vagrant VMs
# To be pasted in ~/.profile
vagrant() {
if [[ $@ == "halt all" ]]; then
command vagrant global-status | grep running | colrm 8 | xargs -L 1 -t vagrant halt
else
command vagrant "$@"
fi
}
@cevek
cevek / result.js
Last active December 15, 2020 05:22
Typescript pre transformer
"use strict";
function Bar(props) { return null; }
React.createElement(Bar, { sdf: true, id: 'hello' });
React.createElement("div", { id: 'hi' }, "abc");
React.createElement("div", null, "abc");
@aral
aral / psextendscriptexample.js
Created June 4, 2011 21:04
Using ExtendScript to save out multiple resolution images from Photoshop (with unsharp mask)
/*
The original files are 960x319.
Image sizes to save:
* 800x266 - Retina for 480x320 resolution (400 logical pixel wide panel areas)
* 740x246 - Desktop and iPad
* 616x205 - Retina for 320x480 resolution (308 logical pixel wide panel areas)
* 400x133 - 480x320 resolution
* 308x102 - 320x480 resolution
package main
import (
"fmt"
"log"
"net/http"
)
func init() {
log.SetFlags(log.Lshortfile)
@ds300
ds300 / yarn-flat-auto.js
Created June 28, 2017 11:45
Automatically choose the latest versions of all packages when running yarn --flat
#!/usr/bin/env node
# run this before using: yarn add --dev node-pty semver
const os = require("os")
const pty = require("node-pty")
const semver = require("semver")
function semverComparator(a, b) {
if (semver.lt(a, b)) {
@disintegrator
disintegrator / wdio.conf.js
Created June 9, 2017 04:13
Run Chrome Headless with WebdriverIO and selenium-standalone
exports.config = {
capabilities: [
{
browserName: 'chrome',
chromeOptions: {
args: ['headless', 'disable-gpu'],
},
},
],
services: ['selenium-standalone'],