Skip to content

Instantly share code, notes, and snippets.

View django-wong's full-sized avatar
👨‍💻
Focusing

Django Wong django-wong

👨‍💻
Focusing
View GitHub Profile
@django-wong
django-wong / example.js
Created October 21, 2018 15:05 — forked from ignlg/example.js
Fixes "TypeError: JSON.stringify cannot serialize cyclic structures" error when exporting to JSON a KeystoneJS model/list including virtuals.
var modelCleanCyclic = require('./modelCleanCyclic');
var Example = new keystone.List('Example', {});
Example.schema.set('toJSON', {
virtuals: true,
transform: modelCleanCyclic.transformer
});
@django-wong
django-wong / Helpers.php
Created July 6, 2017 09:31
helpers to retrieve git commmit infomation
<?php
/**
* @Author: Django Wong
* @Date: 2017-05-03 13:00:26
* @Last Modified by: django-wong
* @Last Modified time: 2017-07-06 17:01:40
*/
if(!function_exists('git_commit_hash')){
/**
@django-wong
django-wong / hosts.js
Created January 7, 2017 18:42 — forked from Swivelgames/hosts.js
Node.js: Simple "Virtual Hosts" with Bouncy
module.exports = [
[ 'sterm.bluelogicteam.com', 8881 ],
[ /^(www\.)?bluelogicteam.com$/, 8882 ],
[ /^(www\.)?toggleswitch.tv$/, 8883 ]
];
@django-wong
django-wong / Mixer.js
Last active February 8, 2022 16:49
Mixer - Javascript
var Mixer = function(){
"use strict";
//Audio buffer
this.buffer = {};
//source delay
this.delay = [];
//when the play will start.
this.when = [];
//where the playback will start.
@django-wong
django-wong / md5.js
Created April 1, 2015 15:27
MD5 - Javascript
var MD5 = function(data) {
// convert number to (unsigned) 32 bit hex, zero filled string
function to_zerofilled_hex(n) {
var t1 = (n >>> 0).toString(16);
return "00000000".substr(0, 8 - t1.length) + t1;
}
// convert array of chars to array of bytes
function chars_to_bytes(ac) {
@django-wong
django-wong / connecter.js
Last active August 29, 2015 14:18
Websocket connecter - Javascript
/**
* Common websocket connecter, only compliant with rapAthorus
* #events
* online
* offline
* onmessage
* connect_failed
* get_token_failed
* other custom events...
@django-wong
django-wong / check.sh
Created April 1, 2015 04:54
检查进程数量
ps -ef |grep $1 |grep -v "grep" |wc -l
$1 = 进程名