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
// from http://stackoverflow.com/questions/11386492/accessing-line-number-in-v8-javascript-chrome-node-js/11386493#11386493 | |
Object.defineProperty(global, '__stack', { | |
get: function(){ | |
var orig = Error.prepareStackTrace; | |
Error.prepareStackTrace = function(_, stack){ return stack; }; | |
var err = new Error; | |
Error.captureStackTrace(err, arguments.callee); | |
var stack = err.stack; | |
Error.prepareStackTrace = orig; |
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
sudo apt-get install -y php-pear php5-dev | |
sudo pecl install mongo | |
sudo sh -c "echo 'extension=mongo.so' > /etc/php5/mods-available/mongo.ini" | |
sudo ln -s /etc/php5/mods-available/mongo.ini /etc/php5/apache2/conf.d/mongo.ini | |
sudo service apache2 restart |
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
var fd = new FormData(); | |
fd.append('file', $('input[type="file"]')[0].files[0]); | |
$.ajax({ | |
url: '/photoUpload', | |
data: fd, | |
processData: false, | |
contentType: false, | |
cache: false, | |
type: 'POST', |
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
<VirtualHost *:81> | |
ServerAdmin [email protected] | |
DocumentRoot /home/ubuntu/www/ft-ru.ru | |
ServerName ft-ru.ru | |
ErrorLog ${APACHE_LOG_DIR}/ft-ru.ru.error.log | |
CustomLog ${APACHE_LOG_DIR}/ft-ru.ru.access.log common | |
SetEnv ENV "development" | |
</VirtualHost> |
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
var mysql = require('mysql'); | |
function handleDisconnect(db_config) { | |
var connection = mysql.createPool(db_config); | |
connection.on('error', function(err) { | |
console.error('db error', err, err.code); | |
if(err.code === 'PROTOCOL_CONNECTION_LOST') { | |
handleDisconnect(db_config); |
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
sudo apt-get install python-setuptools | |
sudo easy_install supervisor | |
sudo sh -c "echo_supervisord_conf > /etc/supervisord.conf" |
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 validateEmail(email) { | |
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | |
return re.test(email); | |
} | |
if(!validateEmail('[email protected]')) { | |
// alarm! | |
} |
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 | |
ini_set('display_errors',1); | |
ini_set('display_startup_errors',1); | |
error_reporting(-1); |
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/bash | |
sudo apt-get install php5-fpm php5-cgi php5-mcrypt | |
sudo sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php5/fpm/php.ini | |
sudo service php5-fpm restart |
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
// first: npm i debug --save | |
// run with DEBUG=worker,worker2 node app.js | |
var debug = require('./debug')('worker'); | |
debug('worker'); | |
var debug2 = require('./debug')('worker2'); | |
debug2('worker2'); |
OlderNewer