Skip to content

Instantly share code, notes, and snippets.

View jiangtao's full-sized avatar
:octocat:
但行好事,也问前程。Up!Up!Up!

jiangtao

:octocat:
但行好事,也问前程。Up!Up!Up!
View GitHub Profile
@mikechambers
mikechambers / context_proxy.js
Last active May 7, 2022 11:07
HTML5 CanvasRenderingContext2D Proxy
/*
Created by Mike Chambers
Copyright 2018
Released under an MIT License
https://github.com/mikechambers
ES6 JavaScript module and class that proxies,
captures and batches all canvas context 2d api
@thedaviddias
thedaviddias / Preload CSS - Not blocking CSS.html
Last active February 1, 2024 08:24
Preload CSS and don't block the DOM with your CSS file request.
<link rel="preload" href="css/global.min.css" as="style" onload="this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="css/global.min.css"></noscript>
<script>
/*! loadCSS. [c]2017 Filament Group, Inc. MIT License */
!function(a){"use strict";var b=function(b,c,d){function j(a){if(e.body)return a();setTimeout(function(){j(a)})}function l(){f.addEventListener&&f.removeEventListener("load",l),f.media=d||"all"}var g,e=a.document,f=e.createElement("link");if(c)g=c;else{var h=(e.body||e.getElementsByTagName("head")[0]).childNodes;g=h[h.length-1]}var i=e.styleSheets;f.rel="stylesheet",f.href=b,f.media="only x",j(function(){g.parentNode.insertBefore(f,c?g:g.nextSibling)});var k=function(a){for(var b=f.href,c=i.length;c--;)if(i[c].href===b)return a();setTimeout(function(){k(a)})};return f.addEventListener&&f.addEventListener("load",l),f.onloadcssdefined=k,k(l),f};"undefined"!=typeof exports?exports.loadCSS=b:a.loadCSS=b}("undefined"!=typeof global?global:this);
/*! loadCSS rel=preload po
@Saul-Mirone
Saul-Mirone / MVVM.js
Last active May 6, 2024 05:27
A simple mvvm
class Register {
constructor() {
this.routes = []
}
regist(obj, k, fn) {
const _i = this.routes.find(function(el) {
if((el.key === k || el.key.toString() === k.toString())
&& Object.is(el.obj, obj)) {
return el
@XadillaX
XadillaX / require.js
Created November 27, 2015 05:25
Hack require demo
"use strict";
var fs = require("fs");
var path = require("path");
var Module = require("module");
var _resolveFilename = Module._resolveFilename.bind(Module);
var cache = {};
var SRC_PATH = path.resolve(__dirname, "../");
@ShirtlessKirk
ShirtlessKirk / performance-timing.js
Last active February 12, 2024 00:32
Performance timing polyfill
/**
* performance-timing.js: Polyfill for performance.timing object
* For greatest accuracy, this needs to be run as soon as possible in the page, preferably inline.
* The values returned are necessarily not absolutely accurate, but are close enough for general purposes.
* @author ShirtlessKirk. Copyright (c) 2014.
* @license WTFPL (http://www.wtfpl.net/txt/copying)
*/
(function (window) {
'use strict';
@z007
z007 / IdCard.txt
Created October 29, 2014 19:01
正则表达式Id card(身份证)验证
来源:http://www.cnblogs.com/devinhua/articles/1726292.html
1、简单的正则表达式:
(1)preg_match("/^(\d{18,18}|\d{15,15}|\d{17,17}x)$/",$id_card)
(2)preg_match("/^(\d{6})(18|19|20)?(\d{2})([01]\d)([0123]\d)(\d{3}) (\d|X)?$/",$id_card)
(3)preg_match("/(^\d{15}$/)|(\d{17}(?:\d|x|X)$/),$id_card)
@soheilhy
soheilhy / nginxproxy.md
Last active May 16, 2024 08:59
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

Git常用备忘.md

引自:http://blogread.cn/it/article/6282?f=sa

配置

git config --global user.name "robbin"  
git config --global user.email "fankai@gmail.com"
git config --global color.ui true
安装zsh
brew install zsh
设置zsh为默认shell
mate /etc/shells
在文末增加:
/usr/local/bin/zsh
将zsh设置为默认的Shell:
if (Meteor.is_client) {
var userName = "PatelNachiket";
Template.hello.greeting = function () {
return "Fetch recent tweets from Twitter stream of user : " ;
};
Template.hello.events = {
'click #fetchButton' : function () {
console.log("Recent tweets from stream!");
$('#fetchButton').attr('disabled','true').val('loading...');