Skip to content

Instantly share code, notes, and snippets.

View zachcr's full-sized avatar
🏠
Working from home

Zach Yang zachcr

🏠
Working from home
View GitHub Profile
@zachcr
zachcr / gist:d8f4d6306e76967b9279
Last active August 29, 2015 14:23
JS CSV String Create Pro Function
function toCsvValue(theValue, sDelimiter) {
var t = typeof (theValue), output = "";
if (typeof (sDelimiter) === "undefined" || sDelimiter === null) {
sDelimiter = '"';
}
if (t === "undefined" || t === null) {
output = "" + ",";
} else if (t === "string") {
@zachcr
zachcr / gist:3ae4580615223007ff3d
Created April 21, 2015 08:05
ZachBergh's gulpfile.js
var gulp = require('gulp');
var concat = require('gulp-concat');
var react = require('gulp-react');
var bower = require('gulp-bower');
var mainBowerFiles = require('main-bower-files');
var sourcemaps = require('gulp-sourcemaps');
var to5 = require('gulp-6to5');
var es6ModuleTranspiler = require("gulp-es6-module-transpiler");
var notify = require("node-notifier");
var del = require("del");
@zachcr
zachcr / gulpfile.js
Last active August 29, 2015 14:18 — forked from insin/gulpfile.js
/*
gulpfile from one of my React applications which has a gulp --production build
set up.
Assumptions:
1. All your own .js/.jsx modules are somewhere under ./src, have unique
filenames and use Node.js-style requires WITHOUT any path information, just
the name of another module somewhere under ./src
func PipCmd(cmds []*exec.Cmd) (pipeLineOutput, collectedStandardError []byte, pipeLineError error) {
// Require at least one command
if len(cmds) < 1 {
return nil, nil, nil
}
// Collect the output from the command(s)
var output bytes.Buffer
var stderr bytes.Buffer
function get(uri) {
return http(uri,'GET');
}
function post(uri,data) {
if(typeof data === 'object' && !(data instanceof String || (FormData && data instanceof FormData))) {
var params = [];
for(var p in data) {
if(data[p] instanceof Array) {
for(var i = 0; i < data[p].length; i++) {
params.push( encodeURIComponenet(p) + '[]=' + encodeURIComponenet(data[p][i]);
@zachcr
zachcr / gh_hook.php
Created October 31, 2013 15:59 — forked from webjay/gh_hook.php
<?php
//error_reporting(E_ALL);
ignore_user_abort(true);
function syscall ($cmd, $cwd) {
$descriptorspec = array(
1 => array('pipe', 'w') // stdout is a pipe that the child will write to
);
$resource = proc_open($cmd, $descriptorspec, $pipes, $cwd);