Skip to content

Instantly share code, notes, and snippets.


Stanley Zheng stanzheng

View GitHub Profile
stanzheng / nginx.conf
Created Mar 13, 2017 — forked from dctrwatson/nginx.conf
Caching NPM proxy using Nginx
View nginx.conf
user www-data;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/;
events {
worker_connections 1024;
View F.d.ts
declare namespace F {
class Either<A, B> {
private constructor();
// Hack to make A and B covariant.
private a: A;
private b: B;
static Left<A, B>(a: A): Either<A, B>;
static Right<A, B>(b: B): Either<A, B>;
stanzheng / emoji.js
Last active May 17, 2017 — forked from beaugunderson/emoji.js
Scrape all emojis with descriptions from website
View emoji.js
/*TODO Remove Tag when Done */
var request = require('request');
var cheerio = require('cheerio');
var fs = require('fs');
console.log('retrieving unicode table...');
request.get('', function (err, response, body) {
console.log('loading data...');
View APACHE: .htaccess pushstate
<ifModule mod_rewrite.c>
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine On
RewriteBase /gift/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php/$1 [L,QSA]
View regex-weburl.js
// Regular Expression for URL validation
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
// Copyright (c) 2010-2013 Diego Perini (
// Permission is hereby granted, free of charge, to any person
stanzheng /
Last active Sep 21, 2017 — forked from zenorocha/.hyper.js
setup your macbook very fast using homebrew, tools of the internet and scripts. all is borrowed
# install homebrew
/usr/bin/ruby -e "$(curl -fsSL"
# homebrew-cask
brew tap phinze/homebrew-cask
brew install brew-cask
# development
View atom_packages_setup
#star on APM and install using apm stars --install
#productivity all langs
apm install autocomplete-plus
apm install autocomplete-snippets
apm install open-last-project
apm install git-log
apm install git-history
View gulpfile.js
var gulp = require('gulp'),
gutil = require('gulp-util'),
sass = require('gulp-sass'),
csso = require('gulp-csso'),
uglify = require('gulp-uglify'),
jade = require('gulp-jade'),
concat = require('gulp-concat'),
livereload = require('gulp-livereload'), // Livereload plugin needed:
tinylr = require('tiny-lr'),
express = require('express'),
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default and default-ssl to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/

This shows how to send messages to a connected Tessel over USB and how to log messages that the Tessel writes to console.log().

You'll need to do a tessel push tessel-code.js to push the script to the Tessel first as it seems you can only have one connection at a time (unless there's another way I'm not aware of).

Then run node host-code.js to send the message to Tessel. You should see Tessel log back the message it received.