Skip to content

Instantly share code, notes, and snippets.

View deanrather's full-sized avatar

Dean Rather deanrather

View GitHub Profile
@deanrather
deanrather / Learning Screen.md
Last active September 22, 2015 05:24
Learning Screen

Learning Screen

Screen (or, gnu-screen) is a terminal emulator which will allow you to have multiple 'virtual terminals' within one actual terminal. A great benefit of screen is that these virtual terminals can run in the background, even after closing the real terminal, they can be picked back up later, even from another machine!

Installation

sudo apt-get install screen -y

Usage

@deanrather
deanrather / Using Git Patch.md
Created July 8, 2014 05:46
How to use Git Patch

How to use Git Patch

In this scenario, a Git Repo has been exported, and the contents of the repo deployed onto an environment.

This deployment does not have any knowledge of Git.

On the deployment:

Initialise a new git repo, so any changes can be tracked.

@deanrather
deanrather / LockHelper.php
Last active August 29, 2015 14:02
PHP Locking and Queuing
<?php
namespace application\helper
{
use nutshell\Nutshell;
use application\helper\SystemHelper;
use application\helper\OutputHelper;
use \exception;
class LockHelper
{
@deanrather
deanrather / gist:7310797
Last active February 15, 2016 05:07
Dean Learns Vim
i         Enter insertion mode
esc       Exit insertion mode
v         Visually select some text
y         Yank (copy) selection (or double-tap for line)
d         Delete (cut) selection (or double-tap for line)
p         Paste
u         Undo
CTRL+R    Redo

:e Open a new file

@deanrather
deanrather / create-package.md
Last active March 15, 2024 04:55
Creating a .deb Package

Creating a .deb Package

This creates a package which runs an install.sh which copies a file somewhere the below is entirely incorrect. Hopefully I'll get around to fixing it tip: this would install to the root dir & the relative path to ./install.sh would be wrong

go to project directory

cd /path/to/project
@deanrather
deanrather / get-timezone.php
Last active March 22, 2018 15:49
Get Timezone with PHP
<?php
echo getTimezone("Sydney");
function getTimezone($location)
{
$location = urlencode($location);
$url = "http://maps.googleapis.com/maps/api/geocode/json?address={$location}&sensor=false";
$data = file_get_contents($url);
// Get the lat/lng out of the data
$data = json_decode($data);
@deanrather
deanrather / .workstation.sh
Last active June 25, 2022 06:28
Configure Work Environment
#!/bin/bash
# Workstation Configurator
# To setup this script, run:
#
# wget -O ~/.workstation git.io/workstation && . ~/.workstation setup
#
# This achieves a few things:
# - Installation & Setup of Programs (Interactive)
# - Provides ~/.workstation file which automatically loads function library
@deanrather
deanrather / cachebust-example.php
Last active December 18, 2015 01:19
CacheBusting function for Nutshell
<?php
// in the controller:
$this->view->setTemplate('index');
$scope = $this;
$this->view->getContext()->registerCallback
(
'cacheBustFilename',
function($publicPath) use ($scope)
{
$publicDir = Nutshell::getInstance()->config->application->dir->publicDir;
@deanrather
deanrather / Git.md
Last active February 15, 2019 18:14
Git Commands I Use a Lot

git status lets you know which branch your on, whether the working tree is modified does not let you know whether there are upstream changes

git fetch recursively pulls down all commits in all branches and submodules does not modify your working tree

tig --all list all commits and all branches, highlights your current checked out commit in cyan

@deanrather
deanrather / nutshell.php
Created September 11, 2012 12:59
redPHP Nutshell Plugin
<?php
// Nutshell Bootstrap
if(!defined('NUTSHELL_DIR'))
{
define('NUTSHELL_DIR', APP_DIR.'/../lib/nutshell/');
define('NUTSHELL_APP_DIR', APP_DIR.'/../nutshell-application');
function bootstrap()
{