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
/** | |
* Создание Web Worker-а без использования внешнего JS-файла. | |
* Работает ТОЛЬКО в Google Chrome (остальные браузеры не поддерживают BlobBuilder) | |
*/ | |
function InlineWorker(code) { | |
var URL = (self.URL || self.webkitURL), BlobBuilder = (self.BlobBuilder || self.WebKitBlobBuilder); | |
var bb = new BlobBuilder(); | |
bb.append("(" + code.toString() + ")();"); | |
var url = URL.createObjectURL(bb.getBlob("application/javascript")); | |
var worker = new Worker(url); |
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
javascript:(function() { var its = document.querySelectorAll("input[type='hidden'][id^='audio_'][value*='.mp3']"); for (var i = 0; i < its.length; i++) { var a = document.createElement('a'); a.href = its[i].value.replace(/,\d+$/, ''); its[i].parentNode.insertBefore(a, its[i]); a.innerHTML = "mp3"; } })(); |
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
/** | |
* Собственно букмарклет: | |
* | |
javascript:(function(){var b=window.location,a;if(b.host=="plus.google.com"&&(a=b.pathname.match(/\/photos\/(\d+)\/albums\/(\d+)$/))){var b=a[1],c=a[2];console.log(c);a=new XMLHttpRequest;a.open("GET","https://plus.google.com/u/0/_/photos/albums/"+b);a.responseType="text";a.onload=function(){for(var a=JSON.parse(this.response.replace(")]}'","").replace(/\[,/g,'["",').replace(/,,/g,',"",').replace(/,,/g,',"",')),b=0;b<a[2].length;b++)if(a[2][b][5]==c){window.location=a[2][b][8];return}alert("Album not found")}; | |
a.send()}else alert("Invalid page address")})(); | |
* | |
* Ниже приведён несжатый код | |
*/ |
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
<?php | |
/** | |
* From http://stackoverflow.com/a/6337021 | |
*/ | |
class Bcrypt { | |
private $rounds; | |
public function __construct($rounds = 12) { | |
if (CRYPT_BLOWFISH != 1) { | |
throw new Exception("bcrypt not supported in this installation. See http://php.net/crypt"); |
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
<?php | |
/** | |
* Implementation of the PBKDF2 key derivation function as described in | |
* RFC 2898. | |
* | |
* @param string $PRF Hash algorithm. | |
* @param string $P Password. | |
* @param string $S Salt. | |
* @param int $c Iteration count. | |
* @param mixed $dkLen Derived key length (in octets). If $dkLen is FALSE |
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
<?php | |
function codeToUtf8($code) { | |
$code = (int)$code; | |
if ($code < 0x80) return chr($code); | |
if ($code < 0x800) return chr(0xC0 + (($code >> 6) & 0x1F)) . | |
chr(0x80 + ($code & 0x3F)); | |
if ($code < 0x10000) return chr(0xE0 + (($code >> 12) & 0x0F)) . | |
chr(0x80 + (($code >> 6) & 0x3F)) . | |
chr(0x80 + ($code & 0x3F)); | |
if ($code < 0x200000) return chr(0xF0 + (($code >> 18) & 0x07)) . |
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
#!/bin/sh | |
if [ $# -eq '0' ] | |
then | |
echo 'Empty command' | |
exit 1 | |
fi | |
stop=0 | |
trap 'stop=1' TERM QUIT INT |
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
[ | |
["Кармин","960018"], | |
["Кардинал","c41e3a"], | |
["Тициановый","d53e07"], | |
["Красный","ff0000"], | |
["Алый","ff2400"], | |
["Карминово-красный","ff0033"], | |
["Киноварь","ff4d00"], | |
["Международный оранжевый","ff4f00"], | |
["Ализариновый","e32636"], |
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
<?php | |
/** | |
* Рекурсивный проход по каталогу | |
* @return array Полный список найденных файлов | |
*/ | |
function recursiveGlob($startDir, $fileMask) { | |
$found = glob($startDir.DIRECTORY_SEPARATOR.$fileMask); | |
$dirs = glob($startDir.DIRECTORY_SEPARATOR."*", GLOB_ONLYDIR); | |
foreach ($dirs as $dir) $found = array_merge($found, recursiveGlob($dir, $fileMask)); | |
return $found; |
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 (undefined) { | |
"use strict"; | |
var | |
isArray = Array.isArray || function (v) { | |
return Object.prototype.toString.call(v) === "[object Array]"; | |
}, | |
isFunction = function (v) { | |
return Object.prototype.toString.call(v) === "[object Function]" | |
}, |
OlderNewer