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 | |
## use statments ## | |
class PageController extends BasePageController | |
{ | |
public const PAGE_LENGTH = 10; | |
public const BIG_PAGE_LENGTH = 100; |
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 | |
namespace App\Shortcode; | |
use Psr\Log\LoggerInterface; | |
use Psr\SimpleCache\CacheInterface; | |
use SilverStripe\Core\Injector\Injector; | |
use SilverStripe\View\Shortcodes\EmbedShortcodeProvider; | |
use Throwable; |
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 | |
/** | |
* Sample usage: php ./PartyChecker.php 'Guybrush Threepwood' 2019-01-01 2019-03-31 | |
* | |
* Sample Output: | |
* | |
* ....xxxxxx.xx.xx..xx..xx.x.....xx.....x.x.x.x....xx.....x.....x...........xx......xxx.x.....x.x..........xxx | |
* .......x....x..........x...............x.....x.....x.....x............xx.....xxx.......x.................... | |
* ..........x....xxxx.x......x.....x.xx.....x......x.......x..xxx..x.x.....x.x.x...x.xx.............xx..xxxxxx |
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
#!/bin/bash | |
# To use - go into your root directory, and rename the file .git/hooks/prepare-commit-msg.sample to .git/hooks/prepare-commit-msg | |
# Then, copy this into that file. Make it executable (chmod +x .git/hooks/prepare-commit-msg) and then reload your terminal | |
# This will then prepend the start of the branch name to your commit messages e.g. [ABC-1234] My sick commit message | |
# This way you can customize which branches should be skipped when | |
# prepending commit message. | |
if [ -z "$BRANCHES_TO_SKIP" ]; then | |
BRANCHES_TO_SKIP=(master) |
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
public function validate() | |
{ | |
$result = parent::validate(); | |
$this->ensureUnique('Title', $result); | |
return $result; | |
} | |
/** | |
* @param string $fieldName |
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
namespace :file_tests do | |
task :exists do | |
user = capture("whoami") | |
logger.debug "User is #{user}" | |
release_dir = capture("readlink /sites/dash/www").strip | |
logger.debug "Release directory is #{release_dir}" | |
file_exists("/etc/environment") | |
file_exists("/etc/not_really_there") | |
file_exists("/sites/dash/www/framework/sake") | |
file_exists("#{release_dir}") |
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
#!/usr/bin/php | |
<?php | |
/** | |
* To use - view source of a page with ?showqueries=1&isDev=1, save queries to a file, pass the file as an arg to the script | |
*/ | |
function output() { | |
foreach (func_get_args() as $message) { | |
echo $message . PHP_EOL; | |
} |