Skip to content

Instantly share code, notes, and snippets.

View zack9433's full-sized avatar
:octocat:
Coding

Zack Yang zack9433

:octocat:
Coding
  • MOXA
  • Taipei, Taiwan
View GitHub Profile
@zack9433
zack9433 / ngrxintro.md
Created September 12, 2017 05:55 — forked from btroncone/ngrxintro.md
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

@zack9433
zack9433 / index.js
Created June 15, 2017 02:10 — forked from dinony/index.js
Unicast Observables
// Here, we create a default Observable, which manages some costly resource
// or performs some heavy computation (denoted by the crying emoji) to push
// values to it's Observers. Now imagine, this could be a http call,
// database connection or socket connection, etc ...
//
// Each subscribed Observer gets an independent execution context.
// If we had only a single subscribe call - everything would be fine.
// We'd have just a single execution, and the costly resource is allocated
// just one time. So far, so good.
//
@zack9433
zack9433 / index.js
Created June 15, 2017 02:09 — forked from dinony/index.js
Multicast Observables: Subjects
// https://gist.github.com/dinony/60332358d25fd18d561395e0b8bf807c
// In the above Gist, we've discussed the constraints of unicast Observables,
// when it comes to sharing a costly resource.
//
// Here, you'll see how Subjects can be used to avoid this problematic scenario.
import {Obervable} from 'rxjs/Observable';
import {Subject} from 'rxjs/Subject';
// Again, we have our default Observable, which manages some costly resource.
const obs = new Observable(observer => {

Minimum Viable Async with Node 6

With the release of Node 6.0.0, the surface of code that needs transpilation to use ES6 features has been reduced very dramatically.

This is what my current workflow looks like to set up a minimalistic and fast microservice using micro and async + await.

The promise

@zack9433
zack9433 / .babelrc
Created May 25, 2016 01:35 — forked from c9s/.babelrc
webpack + babel + typescript + es6 - total solutions!
{
"presets": ["es2015"],
"plugins": ["transform-runtime"]
}
log_format bunyan '{'
'"name": "nginx/$nginx_version",'
'"hostname": "$hostname",'
'"pid": "$pid",'
'"level": 30,'
'"time": "$time_iso8601",'
'"v": 0,'
'"msg": "access",'
'"remoteAddress": "$remote_addr",'
@zack9433
zack9433 / counter.js
Created February 18, 2016 13:24 — forked from podhmo/counter.js
'use strict';
function counter($timeout){
var i = 0;
return (function(){
i += 1;
return i;
});
}
@zack9433
zack9433 / gist:b304fafeb5cddbffe96d
Last active August 29, 2015 14:27 — forked from afutseng/gist:bdd58d8e28e7a2444a25
COSCUP 2015 Hands-on MySQL 入門 by gslin 筆記
https://github.com/gslin/coscup2015-mysql-hands-on
開場
# Transaction
## 原子不可分割性
要碼全部成功不然就全部失敗 - 銀行轉帳 (林益世 v.s. 陳啟祥)
持久性 (D)
@zack9433
zack9433 / commit-msg
Last active August 29, 2015 14:25 — forked from jhartikainen/commit-msg
ESLint git commit hook
#!/bin/bash
files=$(git diff --cached --name-only | grep '\.js$')
# Prevent ESLint help message if no files matched
if [[ $files = "" ]] ; then
exit 0
fi
echo $files | xargs eslint
@zack9433
zack9433 / css_resources.md
Last active August 29, 2015 14:12 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides