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
['Alberta', 'British Columbia', 'Manitoba', 'New Brunswick', 'Newfoundland and Labrador', 'Northwest Territories', 'Nova Scotia', 'Nunavut', 'Ontario', 'Prince Edward Island', 'Quebec', 'Saskatchewan', 'Yukon Territory'] |
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 db = mysql.createConnection({ | |
user : 'dbuser', | |
socketPath : '/tmp/mysql.sock', //wherever the mysql socket is | |
database : 'dbname' | |
}); | |
db.connect(); |
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 dropdownRandomValue(name){ | |
var dropdown = $('#' + name); | |
var values = _.pluck(dropdown.find('option:enabled'), 'value'); | |
var selectedIndex = Math.floor(Math.random() * values.length); | |
return values[selectedIndex]; | |
} |
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
res redirect can use patterns to respect an existing external mount point for an express app/router: | |
res.redirect('/relative/to/host'); | |
res.redirect('relative/to/mount-point'); | |
res.redirect('./relative/to/pathname'); | |
so if you wanted to redirect back to the root mount point for your mounted app, you could do this: | |
res.redirect('./'); |
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
passport-local always fails if the incoming user login name is not named 'username', not very obvious, especially if you use emails as the login name. | |
express, express 4 and passport |
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
head -c 1048576 </dev/urandom > filename |
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
Need to use svn to officially host a wordpress plugin, rather be using git+github, so i mix and match. without git-svn: | |
- make your initial plugin in github | |
- issue a release in github | |
- use the .zip download of the release as your initial submission | |
- once approved you get a wordpress svn repo | |
- check out your empty repo: https://wordpress.org/plugins/about/svn/ | |
- copy your plugin files into the /trunk (including your .git/.gitignore) |
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
By default php-fpm only parses files ending in .php, you can change it in the php-fpm config file (which may be under php-fpm.d/www.conf): | |
;security.limit_extensions = .php .php3 .php4 .php5 | |
to | |
security.limit_extensions = .php .html |
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
git checkout --orphan gh-pages |
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
// Local Variables: | |
// mode: javascript | |
// End: |