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
<?php | |
date_default_timezone_set( 'Europe/Moscow' ); | |
ini_set( 'memory_limit', '1024M' ); | |
$ch = curl_init(); | |
curl_setopt( $ch, CURLOPT_URL, 'https://email.us-east-1.amazonaws.com' ); | |
curl_setopt( $ch, CURLOPT_POST, true ); | |
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); | |
curl_setopt( $ch, CURLOPT_HEADER, true ); |
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 grayscale(src) { | |
var canvas = document.createElement("canvas"), | |
ctx = canvas.getContext("2d"), | |
imgPixels, x, y, i, avg; | |
var imgObj = new Image(); | |
imgObj.src = src; | |
canvas.width = imgObj.width; | |
canvas.height = imgObj.height; |
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
/** | |
* Proxy API implementation example | |
* @link https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Proxy | |
*/ | |
let proxyHandlerMaker = function(obj) { | |
return { | |
// Fundamental traps | |
getOwnPropertyDescriptor: function(name) { | |
var desc = Object.getOwnPropertyDescriptor(obj, name); | |
// a trapping proxy's properties must always be configurable |
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
Array.prototype.average = function() { | |
var i, len, sum = 0; | |
for (i=0, len=this.length; i<len; i++) { | |
sum += this[i]; | |
} | |
return sum / this.length; | |
}; |
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
String.prototype.md5 = function() { | |
var safe_add = function(x, y) { | |
var lsw = (x & 0xFFFF) + (y & 0xFFFF); | |
var msw = (x >> 16) + (y >> 16) + (lsw >> 16); | |
return (msw << 16) | (lsw & 0xFFFF); | |
} | |
var rol = function(num, cnt) { | |
return (num << cnt) | (num >>> (32 - cnt)); |
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
{ | |
map: function(doc) { | |
if (doc.subtype === 'pm') { | |
return; | |
} | |
if (typeof doc.private !== 'undefined' && doc.private === 1) { | |
return; | |
} |
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
./configure \ | |
--prefix=/opt/php \ | |
--sysconfdir=/etc/opt/php \ | |
--enable-fpm \ | |
--disable-cgi \ | |
--with-config-file-path=/etc/opt/php \ | |
--with-config-file-scan-dir=/etc/opt/php/conf.d/ \ | |
--enable-zip \ | |
--with-gettext \ | |
--disable-ftp \ |
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
<?php | |
$cnn = new AMQPConnect(); | |
# подсоединяемся | |
$exch = new AMQPExchange( $cnn ); | |
$exch->declare( 'testing', 'direct', AMQP_DURABLE ); | |
if ( true === isset( $_GET['publish'] ) ) { | |
for ( $i=1; $i<=5; $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
./configure \ | |
--prefix=/opt/local \ | |
--conf-path=/etc/opt/nginx/nginx.conf \ | |
--pid-path=/opt/local/var/run/nginx.pid \ | |
--error-log-path=/opt/local/var/log/nginx/error.log \ | |
--http-log-path=/opt/local/var/log/nginx/access.log \ | |
--user=ubuntu \ | |
--group=ubuntu | |
# libssl-dev - библиотека для md5 функций OpenSSL |