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
{ | |
"require": { | |
"phpmailer/phpmailer": "5.2.1" | |
}, | |
"repositories": [ | |
{ | |
"type": "package", | |
"package": { | |
"name": "phpmailer/phpmailer", | |
"version": "5.2.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
# Bash Profile | |
# File: ~/.bash_profile | |
# Set $WEB_DIR and $SCRIPTS_DIR to the appropriate directories. | |
export PATH="./vendor/bin:$PATH" | |
export EDITOR=nano | |
export WEB_DIR="/var/www/vhosts" | |
export SCRIPTS_DIR="~/.web" |
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 | |
// src/Foobar/Controller/FooController.php | |
namespace Foobar\Controller; | |
class FooController | |
{ | |
public function helloAction($request) | |
{ |
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
$.extend({ | |
isMobile: function() { | |
return navigator.userAgent.match(/Android|webOS|iPhone|iPod|iPad|BlackBerry/i) !== null; | |
} | |
}); |
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 useradd -m -d /home/<username> -s /bin/bash -k /etc/skel -g <primarygroup> -G sudo <username> | |
sudo passwd <username> | |
sudo deluser <username> | |
chsh -s /bin/bash <username> |
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
/** | |
* Command: casperjs chomecast-bgs.js [DIR] [START] [END] | |
* Examples: casperjs chomecast-bgs.js ~/Downloads/Chromecast | |
* casperjs chomecast-bgs.js ~/Downloads/Chromecast 25 | |
* casperjs chomecast-bgs.js ~/Downloads/Chromecast 25 35 | |
* | |
* Note: [DIR] (Required) The directory to download. This must exist, it won't be created. | |
* [START] (Optional) Start is the image number to start from, incase the script fails and needs to be restarted. | |
* [END] (Optional) End is the image number to finish at, if you only want a specific range of images. | |
*/ |
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 | |
// http://content.codersdojo.org/code-kata-catalogue/fizz-buzz/ | |
foreach (range(1, 100) as $i) { | |
$x = ''; | |
$x .= ($i % 3 === 0 ? 'Fizz' : ''); | |
$x .= ($i % 5 === 0 ? 'Buzz' : ''); | |
echo $i . ' ' . (empty($x) ? $i : $x) . "\n"; | |
} |
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 | |
/** | |
* Checklist Field Type. | |
* | |
* File: PERCH_PATH/addons/fieldtypes/checklist/checklist.class.php | |
* Usage: <perch:content id="features" type="checklist" label="Features" options="Feature 1, Feature 2, Feature 3" /> | |
* @author Jamie York | |
**/ | |
class PerchFieldType_checklist extends PerchAPI_FieldType | |
{ |
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
#!/usr/bin/env php | |
<?php | |
// Left associative ternary. | |
// Output: T | |
echo (true ? 'True' : false ? 'T' : 'F') . "\n"; | |
// This is essentially the same as above. | |
// Output: T | |
echo ((true ? 'True' : false) ? 'T' : 'F') . "\n"; |
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 | |
$prime = function($num) { | |
if ($num === 1) { | |
return false; | |
} | |
if ($num === 2) { | |
return true; | |
} |