Skip to content

Instantly share code, notes, and snippets.

View nathanbrauer's full-sized avatar

Nathan J. Brauer nathanbrauer

View GitHub Profile
<?php
namespace Nightjar\SS4UpgradeTasks;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
use Psr\Log\LoggerInterface;
use SilverStripe\Assets\File;
use SilverStripe\Control\Director;
use SilverStripe\Core\ClassInfo;
@Tanapruk
Tanapruk / gitpullalllocal.sh
Created March 28, 2017 14:20
Looping through all local git branch and git pull them each
function gitPullAllLocal() {
#if there is a passing argument
if [ -z $1 ]
then
GIT_RELATIVE_DIRECTORY="$(pwd)"
else
GIT_RELATIVE_DIRECTORY=$1
fi
#go to that relative path if exists
@ryanwachtl
ryanwachtl / _ss_environment.php
Last active August 31, 2016 02:23
Use server environment variables to setup your SilverStripe environment
<?php
/**
* Configure SilverStripe using apache environment variables
* Usage: Put "require_once('conf/ConfigureFromEnv.php');" into your _config.php file.
* Example Apache vhost:
* <VirtualHost *:80>
* ...
* SetEnv SS_ENVIRONMENT_TYPE dev
* SetEnv SS_DEFAULT_ADMIN_USERNAME admin
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@inxilpro
inxilpro / http_response_code.php
Created August 23, 2013 15:08
Polyfill for PHP 5.4's http_response_code() function.
<?php
if (!function_exists('http_response_code')) {
function http_response_code($code = null)
{
static $defaultCode = 200;
if (null != $code) {
switch ($code) {
case 100: $text = 'Continue'; break; // RFC2616
@amereservant
amereservant / biblebooks.php
Last active January 5, 2021 21:05
Simple PHP array of the Books of the Bible
<?php
$books = array(
1 => 'Genesis',
2 => 'Exodus',
3 => 'Leviticus',
4 => 'Numbers',
5 => 'Deuteronomy',
6 => 'Joshua',
7 => 'Judges',
8 => 'Ruth',
@fajrif
fajrif / gist:1265203
Created October 5, 2011 18:12
git clone specific tag
git clone <repo-address>
git tag -l
git checkout <tag-name>
git branch -D master
git checkout -b master
@matthewmccullough
matthewmccullough / git-deletealltags.bsh
Created April 1, 2011 20:29
Script to delete all tags both locally and remotely
for t in `git tag`
do
git push origin :$t
git tag -d $t
done