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
// Why does this print 'Redirecting' but then send 'You are special' anyway? | |
function secure(req, res, next) { | |
if (!req.user) { | |
console.log('Redirecting'); | |
req.session.afterLogin = req.url; | |
res.redirect('/login'); | |
return; | |
} | |
else | |
{ |
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 | |
// Are your fastcgi processes spread out evenly over the available hyperthreads on your server? | |
// This script will tell you. | |
// | |
// If your php-cgi process is not /usr/local/bin/php-cgi, tweak accordingly. | |
// | |
// In my experience they do tend to distribute pretty well over time, but see also | |
// assignhyperthreads.php. | |
// |
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 | |
// This script will spread out your php-cgi fastcgi processes | |
// evenly over the hyperthreads of your server. | |
// If your php-cgi process is not /usr/local/bin/php-cgi, | |
// tweak accordingly. | |
// | |
// [email protected], @boutell, punkave.com |
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 | |
// Install me via cron: | |
// [email protected] | |
// * * * * * /usr/local/bin/php /home/someaccount/loadwatch.php | |
$fields = explode(' ', file_get_contents('/proc/loadavg')); | |
$avg = $fields[0]; | |
$last = @file_get_contents("/home/gps/cpulast.txt"); |
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
// Display a map with markers that link to other pages. Each marker must | |
// have latitude, longitude and slug properties. There must also be a | |
// a 'url' option which is used to build the links. The following | |
// wildcards are replaced in the url: ID (with the id), SLUG (with the | |
// slug property), PUBLISHED (with /year/month/day taken from published_at), | |
// and START (with /year/month/day taken from start_date). In other words, | |
// you can pass most array-hydrated Doctrine objects, including Apostrophe | |
// blog posts and events, and easily generate links back to them. | |
// The hover text title of the marker is taken from title if present, |
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
PunkAve\GPS\SchoolBundle\Entity\School: | |
constraints: | |
- \Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity: psp_id | |
- \Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity: name |
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
[mysqld] | |
datadir=/var/lib/mysql | |
socket=/var/lib/mysql/mysql.sock | |
user=mysql | |
# Use new password format for compatibility with newer PHP | |
old_passwords=0 | |
# Disabling symbolic-links is recommended to prevent assorted security risks; | |
# to do so, uncomment this line: | |
# symbolic-links=0 |
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
svn up && ./symfony apostrophe:deploy staging staging && ./symfony apostrophe:deploy production prod |
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
./symfony scrape-legacy-site --series-only && ./symfony create-entities --import-posts | |
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
// Render a view specific to this module | |
function render(res, template, info) { | |
return res.render(__dirname + '/views/' + template, info); | |
} |