Skip to content

Instantly share code, notes, and snippets.

View wonglok's full-sized avatar
🙏
Thank you Jesus for the new life

Wong Lok wonglok

🙏
Thank you Jesus for the new life
View GitHub Profile
@paulirish
paulirish / bling.js
Last active May 1, 2024 19:56
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@steveblue
steveblue / ScrollHandler.js
Last active November 1, 2015 04:36
ScrollHandler, a layout agnostic Famo.us module for scrolling.
/* global famous */
define(function(require, exports, module) {
var Utility = famous.utilities.Utility;
var MouseSync = famous.inputs.MouseSync;
var TouchSync = famous.inputs.TouchSync;
var ScrollSync = famous.inputs.ScrollSync;
var GenericSync = famous.inputs.GenericSync;
var Transitionable = famous.transitions.Transitionable;
var Easing = famous.transitions.Easing;
@bendc
bendc / functional-utils.js
Last active September 15, 2023 12:12
A set of pure ES2015 functions aimed to make functional JavaScript more idiomatic.
// array utils
// =================================================================================================
const combine = (...arrays) => [].concat(...arrays);
const compact = arr => arr.filter(Boolean);
const contains = (() => Array.prototype.includes
? (arr, value) => arr.includes(value)
: (arr, value) => arr.some(el => el === value)
@lmccart
lmccart / gist:2273a047874939ad8ad1
Last active February 18, 2024 21:57
p5.js + p5.dom.js + clmtracker.js
<html>
<head>
<script src="clmtrackr.js"></script>
<script src="model_pca_20_svm.js"></script>
<script src="p5.js"></script>
<script src="p5.dom.js"></script>
<script>
var ctracker;
@loo2k
loo2k / wechat-browser-detect.js
Last active March 14, 2019 02:08
JavaScript 判断是否微信内置浏览器
var isWeixin = false;
if (typeof WeixinJSBridge == "object" && typeof WeixinJSBridge.invoke == "function") {
isWeixin = true;
} else {
if (document.addEventListener) {
document.addEventListener("WeixinJSBridgeReady", function() { isWeixin = true; }, false);
} else if (document.attachEvent) {
document.attachEvent("WeixinJSBridgeReady", function() { isWeixin = true; });
document.attachEvent("onWeixinJSBridgeReady", function() { isWeixin = true; });
@staltz
staltz / introrx.md
Last active May 3, 2024 13:00
The introduction to Reactive Programming you've been missing
@wonglok
wonglok / wildcard_search.dart
Last active August 29, 2015 14:02
AngularDart WildCardFilter :)
library wildcard_filter;
import 'package:angular/angular.dart';
class WildcardFilter{
static final String DEFAULT_SEPARATOR = ' ';
/*
* AngularJS Filter fnc "call"
@stevekinney
stevekinney / _.md
Created March 25, 2014 18:10
Lorenz Curve
@JedWatson
JedWatson / KeystoneApiExample.md
Last active July 26, 2021 11:29
Example of how to scaffold API endpoints for Posts in a Keystone project (based on the yo keystone example).

This is an example of how to scaffold API endpoints to list / get / create / update / delete Posts in a Keystone website.

It's a modification of the default project created with the yo keystone generator (see https://github.com/JedWatson/generator-keystone)

Gists don't let you specify full paths, so in the project structure the files would be:

routes-index.js        -->    /routes/index.js         // modified to add the api endpoints
routes-api-posts.js    -->    /routes/api/posts.js     // new file containing the Post API route controllers
@wonglok
wonglok / consoleLogo.js
Last active August 29, 2015 13:57
Console Image lgoo
function consoleLogo(width,height,url,comment){
'use strict';
//config
var lineHeight = 14;
//build string
var str = '';