Skip to content

Instantly share code, notes, and snippets.

Avatar

Stanley Zheng stanzheng

View GitHub Profile
@stanzheng
stanzheng / main.c
Created May 13, 2020 — forked from ColorfulCodes/main.c
This is the mt3620 blinky
View main.c
#include <stdbool.h>
#include <errno.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <applibs/storage.h>
#include <applibs/log.h>
#include <applibs/gpio.h>
@stanzheng
stanzheng / hb_all_books_dl.js
Last active Aug 19, 2018 — forked from graymouser/hb_all_books_dl.js
Humble bundle book bundles - download all books at once
View hb_all_books_dl.js
/*
After purchasing a humble book bundle, go to your download page for that bundle.
Open a console window for the page and paste in the below javascript
Updated: Credit @jmerle
*/
const commands = [];
document.querySelectorAll('.row').forEach(row => {
const bookTitle = row.dataset.humanName;
View rabbitasyncawait.js
var amqp = require('amqplib')
var open = require('amqplib').connect('amqp://localhost');
const connect = (url = 'amqp://localhost') => {
return new Promise((resolve, reject) => {
amqp.connect(url)
.then(conn => resolve(conn))
.catch(err => reject(err))
})
View magic.js
class Magic {
constructor(fn, a) {
this.__chain = [[fn, a]];
}
get(t, a) {
if (a == "✨✨MAGIC✨✨") return true;
if (a == "resolve") {
return () => Magic.chain(this.__chain);
}
return (...b) => {
@stanzheng
stanzheng / Fork-This-Talk.html
Last active Oct 24, 2017 — forked from ryanj/Fork-This-Talk.html
ATO2017 Lightning Talks - Revealjs presentation hacks with gist-reveal - http://bit.ly/ato-reveal
View Fork-This-Talk.html
<section>
<h2><span class='fragment fade-right'>ryanj</span> <span class='fragment fade-up'>@</span> <span class='fragment fade-left'>red hat</span></h2>
<h1 class='fragment fade-up'>RevealJS Presentation Hacks</h1>
<h4 class='fragment fade-up'><a href="http://gist-reveal.it/57830ddbac95a9b3a6d464a03572cc74">http://gist-reveal.it/57830ddbac95a9b3a6d464a03572cc74</a></h4>
</section>
<section data-markdown>
## reveal.js
https://github.com/hakimel/reveal.js#revealjs--
@stanzheng
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/nginx.pid;
events {
worker_connections 1024;
}
@stanzheng
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/nginx.pid;
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
stanzheng / emoji.js
Last active May 17, 2017 — forked from beaugunderson/emoji.js
Scrape all emojis with descriptions from unicode.org/emoji/charts 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('http://unicode.org/emoji/charts/full-emoji-list.html', 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]
</ifModule>