View performance.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var readyStart = timing.fetchStart - timing.navigationStart; | |
var redirectTime = timing.redirectEnd - timing.redirectStart; | |
var appcacheTime = timing.domainLookupStart - timing.fetchStart; | |
var unloadEventTime = timing.unloadEventEnd - timing.unloadEventStart; | |
var lookupDomainTime = timing.domainLookupEnd - timing.domainLookupStart; | |
var connectTime = timing.connectEnd - timing.connectStart; | |
var requestTime = timing.responseEnd - timing.requestStart; | |
var initDomTreeTime = timing.domInteractive - timing.responseEnd; | |
var domReadyTime = timing.domComplete - timing.domInteractive; | |
var loadEventTime = timing.loadEventEnd - timing.loadEventStart; |
View clear.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// open: https://www.linkedin.com/feed/following/ | |
// Attention: versionTag(TODO) | |
var csrf_token, lang, instance, track, version; | |
function fetchList(start, count) { | |
return $.ajax({ | |
url: "https://www.linkedin.com/voyager/api/feed/richRecommendedEntities", | |
dataType: 'json', | |
data: { |
View weibopicbed.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from https://github.com/suxiaogang/WeiboPicBed | |
// under its license | |
function uploadToWeibo( url , callback ) | |
{ | |
var xhr = new XMLHttpRequest(); | |
xhr.onload = function() { | |
var reader = new FileReader(); | |
reader.onloadend = function( e ) | |
{ |
View alfred-pinyin.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
# -*- coding: utf-8 -*- | |
# @author weishu @2015/12/7 | |
import subprocess | |
import os | |
import re | |
import json |
View xmq.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const request = require('request'); | |
const BASE = 'https://api.xiaomiquan.com/v1.2/groups/4512888248/topics'; | |
const ORIGIN = 'https://wx.xiaomiquan.com'; | |
const REFERER = 'https://wx.xiaomiquan.com/dweb/'; | |
const UA = 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36'; | |
const AUTHORIZATION = 'xxx'; | |
const pageSize = '?count=20'; | |
const end_time = (t) => t ? `&end_time=${encodeURIComponent(t)}` : t; |
View index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="http://cdn.staticfile.org/socket.io/1.3.7/socket.io.js"></script> | |
<script src="http://cdn.staticfile.org/jquery/2.2.1/jquery.min.js"></script> | |
<script> | |
function htmlspecialchars(str){ | |
str = str || ''; | |
str = str.replace(/&/g, '&'); | |
str = str.replace(/</g, '<'); | |
str = str.replace(/>/g, '>'); | |
str = str.replace(/"/g, '"'); |
View atom-sync
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# atom-sync |
View doublebits.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const db = require('double-bits'); | |
const pad = require('pad'); | |
// [lo, hi] where lo is a 32 bit integer and hi is a 20 bit integer. | |
const base2Str = (n) => { | |
const f = db.fraction(n); | |
const s = db.sign(n) ? '-' : ''; | |
const e = `2^${db.exponent(n) + 1}`; | |
const t = `0.${pad(f[1].toString(2), 20, '0')}${pad(f[0].toString(2), 32, '0')}`; | |
return `${s}${e} * ${t}`; |
View mongo.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var MongoClient = require('mongodb').MongoClient; | |
var mg = require('../config').mongodb; | |
var DB = function(){ | |
this.url = "mongodb://" + mg['host'] + ":" + mg['port'] + "/" + mg['database']; | |
}; | |
module.exports = new DB; | |
DB.prototype.connect = function(cb){ |
View mongo.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var MongoClient = require('mongodb').MongoClient; | |
var mg = require('../config').mongodb; | |
var DB = function(){ | |
this.url = "mongodb://" + mg['host'] + ":" + mg['port'] + "/" + mg['database']; | |
}; | |
module.exports = new DB; | |
DB.prototype.connect = function(cb){ |
NewerOlder