This file contains hidden or 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
/*jslint regexp: true, maxerr: 50, indent: 2 */ | |
(function (global) { | |
"use strict"; | |
function URLUtils(url, baseURL) { | |
var m = String(url).replace(/^\s+|\s+$/g, "").match(/^([^:\/?#]+:)?(?:\/\/(?:([^:@\/?#]*)(?::([^:@\/?#]*))?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/); | |
if (!m) { | |
throw new RangeError(); | |
} |
This file contains hidden or 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
// http://www.w3.org/TR/html5/association-of-controls-and-forms.html#concept-form-submit | |
// FormData (to support files?) FormData.append... (only POST + not string result???) | |
function serializeForm(form, submitter, useFormData) { | |
useFormData = useFormData && window.FormData; | |
var results = useFormData ? (new FormData()) : [], tagName, i, opts, j, field, elements = form.elements; | |
for (j = 0; j < elements.length; j++) { | |
field = elements[j]; | |
tagName = field.tagName.toLowerCase(); | |
if (tagName === 'object' || (tagName === 'input' && (field.type === 'image' || (!useFormData && field.type === 'file')))) { | |
return null; |
This file contains hidden or 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
/*jslint plusplus: true, vars: true, indent: 2 */ | |
/* | |
convertPointFromPageToNode(element, event.pageX, event.pageY) -> {x, y} | |
returns coordinate in element's local coordinate system (works properly with css transforms without perspective projection) | |
convertPointFromNodeToPage(element, offsetX, offsetY) -> {x, y} | |
returns coordinate in window's coordinate system (works properly with css transforms without perspective projection) | |
*/ |
This file contains hidden or 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
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<script type="text/javascript"> | |
var nativeAtob = window.atob; | |
var nativeBtoa = window.btoa; | |
// http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#atob | |
(function (global) { | |
"use strict"; |
This file contains hidden or 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 crc32(s/*, polynomial = 0x04C11DB7, initialValue = 0xFFFFFFFF, finalXORValue = 0xFFFFFFFF*/) { | |
s = String(s); | |
var polynomial = arguments.length < 2 ? 0x04C11DB7 : (arguments[1] >>> 0); | |
var initialValue = arguments.length < 3 ? 0xFFFFFFFF : (arguments[2] >>> 0); | |
var finalXORValue = arguments.length < 4 ? 0xFFFFFFFF : (arguments[3] >>> 0); | |
var table = new Array(256); | |
var reverse = function (x, n) { | |
var b = 0; |
This file contains hidden or 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
// http://en.wikipedia.org/wiki/Permutation#Generation_in_lexicographic_order | |
// callback(permutation, even) | |
function permutations(n, callback) { | |
n >>>= 0; | |
var p = n ? [] : null, | |
even = true; | |
for (i = 0; i < n; i++) { | |
p[i] = i; | |
} |
This file contains hidden or 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
// http://en.wikipedia.org/wiki/Approximate_string_matching | |
function fuzzySearch(t, p) { // returns minimum edit distance between substring of t and p | |
var a = [], // current row | |
b = [], // previous row | |
pa = [], // from | |
pb = [], | |
s, i, j; | |
for (i = 0; i <= p.length; i++) { | |
s = b; | |
b = a; |
This file contains hidden or 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 strtolower_utf8($string) { | |
$convert_to = array( | |
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", | |
"v", "w", "x", "y", "z", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", | |
"ð", "ñ", "ò", "ó", "ô", "õ", "ö", "ø", "ù", "ú", "û", "ü", "ý", "а", "б", "в", "г", "д", "е", "ё", "ж", | |
"з", "и", "й", "к", "л", "м", "н", "о", "п", "р", "с", "т", "у", "ф", "х", "ц", "ч", "ш", "щ", "ъ", "ы", | |
"ь", "э", "ю", "я" | |
); | |
$convert_from = array( | |
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", |
This file contains hidden or 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
/*jslint node: true, indent: 2 */ | |
"use strict"; | |
var httpPort = 4022; | |
var http = require('http'); | |
var dgram = require('dgram'); | |
var querystring = require('querystring'); |
This file contains hidden or 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
CREATE TABLE IF NOT EXISTS `rabota_ids` ( | |
`ID` varchar( 255 ) NOT NULL DEFAULT '', | |
`region` varchar( 1 ) NOT NULL , | |
`parsed` varchar( 1 ) DEFAULT '0', | |
`added` date NOT NULL , | |
UNIQUE KEY `ID` ( `ID` ) | |
) ENGINE = MYISAM DEFAULT CHARSET = utf8; | |
ALTER TABLE `zarplata_v` CHANGE `source` `source` ENUM( '0', '1', '2', '3', '4' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0'; | |
ALTER TABLE `zarplata_r` CHANGE `source` `source` ENUM( '0', '1', '2', '3', '4' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0'; |
OlderNewer