Skip to content

Instantly share code, notes, and snippets.

View ajaxsys's full-sized avatar
🎯
Focusing

Andy Fang ajaxsys

🎯
Focusing
  • Yokohama, Japan
View GitHub Profile
@ajaxsys
ajaxsys / music.pac
Last active October 14, 2015 04:31
pac for music.163.com https://goo.gl/E1s7Yt
function FindProxyForURL(url, host)
{
if (host == "music.163.com")
return "PROXY 124.126.126.105:80;PROXY 122.72.0.242:8080;PROXY 123.59.25.227:80;PROXY 122.96.59.99:83;PROXY 115.182.83.38:8080;";
return "DIRECT";
}
// AVLTree ///////////////////////////////////////////////////////////////////
// This file is originally from the Concentré XML project (version 0.2.1)
// Licensed under GPL and LGPL
//
// Modified by Jeremy Stephens.
// Pass in the attribute you want to use for comparing
function AVLTree(n, attr) {
this.init(n, attr);
}
@ajaxsys
ajaxsys / isPrimeNumber
Created August 4, 2014 09:37
JS check is Prime Number
function isPrime(number) {
var start = 2, end = Math.sqrt(number);
while (start <= end) {
start++;
if (number % start < 1)
return false;
}
return number > 1;
}
@ajaxsys
ajaxsys / javascript-override-element-native-function
Last active August 29, 2015 14:04
javascript-override-element-native-function
// From http://webreflection.blogspot.jp/2007/02/could-i-extend-native-function.html
// Basic example
document.createElement = (function(createElement, Element) {
return function(nodeName) {
var element, key;
try {
element = createElement(nodeName)
} catch (e) {
element = createElement.call(document, nodeName)
};