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
#include <iostream> | |
#include <sstream> | |
#include <functional> | |
#include <vector> | |
template <typename T, typename U> | |
U foldLeft(const std::vector<T>& data, | |
const U& initialValue, | |
const std::function<U(U,T)>& foldFn) { | |
typedef typename std::vector<T>::const_iterator Iterator; |
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
export default function BrowserType() { | |
// 权重:系统 + 系统版本 > 平台 > 内核 + 载体 + 内核版本 + 载体版本 > 外壳 + 外壳版本 | |
const ua = navigator.userAgent.toLowerCase(); | |
const testUa = regexp => regexp.test(ua); | |
const testVs = regexp => ua.match(regexp) | |
.toString() | |
.replace(/[^0-9|_.]/g, "") | |
.replace(/_/g, "."); | |
// 系统 | |
let system = "unknow"; |
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
function MakePlayConctrl(){ | |
played = false; | |
function autoPlayAudio(video) { | |
// var video = document.getElementById(id).getElementsByTagName("video")[0]; | |
if (window.WeixinJSBridge) { | |
WeixinJSBridge.invoke('getNetworkType', {}, function (e) { | |
played|| video.play().then(()=>{played=true}); |
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
// @credit: http://stackoverflow.com/questions/8609289/convert-a-binary-nodejs-buffer-to-javascript-arraybuffer | |
// From Buffer to ArrayBuffer: | |
function toArrayBuffer(buffer) { | |
var ab = new ArrayBuffer(buffer.length); | |
var view = new Uint8Array(ab); | |
for (var i = 0; i < buffer.length; ++i) { | |
view[i] = buffer[i]; | |
} |
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
""" | |
Displays WoW health and mana status on a Razer Chroma keyboard. | |
Installation (Windows): | |
$ virtualenv venv | |
$ pip install requests | |
$ easy_install pillow | |
Usage: | |
- Run WoW client fullscreen on main monitor |
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
// own.rim.db.gundb-graphdb-api-notes.js | |
// JavaScript based graph-DB module developer user guide wishes | |
// created by Leonard Pauli, 28 aug 2019 | |
// | |
/* includes: | |
install/access module | |
(add, remove, change, traverse) values | |
get current value | |
simple data structures (set) | |
(subscribe, unsubscribe) to changes |
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
//CLIENT | |
Gun.on('opt', function (ctx) { | |
if (ctx.once) { | |
return | |
} | |
this.to.next(ctx) | |
ctx.on('auth', function(msg){ | |
let to = this.to | |
clientAuth(ctx) | |
function clientAuth(ctx){ |
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
/* | |
remote-data ported to ReasonML | |
See also https://github.com/krisajenkins/remotedata | |
Tools for fetching data from remote sources (incl. HTTP). | |
*/ | |
type remoteData 'e 'a | |
= NotAsked | |
| Loading |
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
/* Graph */ | |
exception Not_found; | |
type nodes = list(int); | |
type edges = list((int, int)); | |
type graph = | |
| Empty | |
| Graph(nodes, edges); |
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
/* AVL Tree */ | |
/* A balanced Binary Search Tree */ | |
exception Undefined; | |
module type AvlTree = { | |
type t = int; | |
type height = int; | |
type tree('t) = | |
| Leaf | |
| Node(height, tree('t), 't, tree('t)); |
NewerOlder