Skip to content

Instantly share code, notes, and snippets.

Avatar

Khoa Nguyen thangngoc89

View GitHub Profile
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@thangngoc89
thangngoc89 / App.re
Created Aug 6, 2018 — forked from mhallin/App.re
Async import pattern
View App.re
PageModule.fetchModule("./MyComponent")
|> Js.Promise.then_(m => send(SetRootElement(m())));
View keybase.md

Keybase proof

I hereby claim:

  • I am thangngoc89 on github.
  • I am thangngoc89 (https://keybase.io/thangngoc89) on keybase.
  • I have a public key ASAGw1gNieyFrHGx5uYkdpPcM8kx1iUCbaEc65OSRnXHFQo

To claim this, I am signing this object:

@thangngoc89
thangngoc89 / vpn.md
Created Feb 14, 2018 — forked from joepie91/vpn.md
Don't use VPN services.
View vpn.md

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

(A Russian translation of this article can be found here, contributed by Timur Demin.)

Why not?

View berlin-jsconf-2014.md
@thangngoc89
thangngoc89 / db.js
Created Jun 2, 2017 — forked from soldair/db.js
backup a running node levelup process
View db.js
var levelup = require('level')
var zlib = require('zlib')
var fs = require('fs')
var through = require('through')
//hot backup
db = levelup(...)
var backingup = false
@thangngoc89
thangngoc89 / msconvert.js
Created Dec 30, 2015 — forked from remino/msconvert.js
JavaScript: Convert milliseconds to object with days, hours, minutes, and seconds
View msconvert.js
function convertMS(ms) {
var d, h, m, s;
s = Math.floor(ms / 1000);
m = Math.floor(s / 60);
s = s % 60;
h = Math.floor(m / 60);
m = m % 60;
d = Math.floor(h / 24);
h = h % 24;
return { d: d, h: h, m: m, s: s };
View snippet.php
$categories = array(
'Xe' => array(
'Xe máy',
'Xe ô tô',
),
'Điện thoại, Viễn thông' => array(
'Điện thoại',
'Linh kiện, phụ kiện',
),
);
View file.php
// Database connector
<?php
use Illuminate\Database\Capsule\Manager as Capsule;
/**
* Configure the database and boot Eloquent
*/
global $capsule;
$capsule = new Capsule;
$capsule->addConnection(array(
'driver' => getenv('DB_DRIVER'),