Skip to content

Instantly share code, notes, and snippets.

@deizel
deizel / tail.php
Created October 6, 2012 22:08
PHP log tail example
<?php
if (isset($_GET['ajax'])) {
session_start();
$handle = fopen('/private/var/log/system.log', 'r');
if (isset($_SESSION['offset'])) {
$data = stream_get_contents($handle, -1, $_SESSION['offset']);
echo nl2br($data);
} else {
fseek($handle, 0, SEEK_END);
$_SESSION['offset'] = ftell($handle);
@deizel
deizel / backup.bat
Last active August 24, 2019 09:16
Robocopy - desktop archiver
@echo off
set robocopy=C:\Program Files\Windows Resource Kits\Tools\robocopy.exe
set source=C:\Documents and Settings\%username%\Desktop
set destination=%source%\backup\%date:~6,4%-%date:~3,2%
set exclude_dirs=backup downloads dropbox projects
set exclude_files=*.lnk *.bat
md "%backup%"
"%robocopy%" "%source%" "%destination%" /mov /e /xd %exclude_dirs% /xf %exclude_files% /xx
pause
@deizel
deizel / README.md
Created July 31, 2015 20:11
Multiple global Composer installations

Multiple global Composer installations

When setting up CI servers, it can sometimes be necessary to have different versions of Composer dependencies installed globally.

For example, when your CI server mainly deals with CakePHP 2.x and 3.x applications, where the coding standards vary.

This guide aims to walk you through how one might acheive this.

Composer home

@deizel
deizel / gist:9230ab493ada786358bf
Last active August 3, 2017 21:52
List of constants in CakePHP 3.0
deizel at CakeDC in ~/Projects/cakephp (3.0●)
$ ag "const "
src/Console/ConsoleOutput.php
51: const RAW = 0;
58: const PLAIN = 1;
65: const COLOR = 2;
72: const LF = PHP_EOL;
src/Console/ConsoleIo.php
58: const VERBOSE = 2;
#!/usr/bin/env bash
set -e
sudo route -n delete 172.17.0.0/16
sudo route -n add 172.17.0.0/16 local.docker
DOCKER_INTERFACE=$(route get local.docker | grep interface: | cut -f 2 -d: | tr -d ' ')
DOCKER_INTERFACE_MEMBERSHIP=$(ifconfig "${DOCKER_INTERFACE}" | grep member: | cut -f 2 -d: | cut -c 2-4)
@deizel
deizel / keybase.md
Created February 22, 2016 02:00
keybase prove github deizel

Keybase proof

I hereby claim:

  • I am deizel on github.
  • I am deizel (https://keybase.io/deizel) on keybase.
  • I have a public key ASCPDlKpiQTlFfqLAA74eY_hXEiy9vMF3NF6owa2M3LLCAo

To claim this, I am signing this object:

@deizel
deizel / launcher.bat
Created November 9, 2012 00:13
Application launcher
@echo off
:go
echo What do you want to close?
echo.
echo 1. [D]esign
echo 2. [W]indows
echo 3. [M]usic
echo 4. [E]ntertainment
echo 5. [G]ames
@deizel
deizel / .gitignore
Last active October 11, 2015 12:08
Quickly set up a bunch of PHP projects (without dependencies) from Composer cache
build/
deizel@imac : ~/Development/stackoverflow
% cd 12787540-using-pear-xmlrpc2-inside-wordpress-plugin
deizel@imac : ~/Development/stackoverflow/12787540-using-pear-xmlrpc2-inside-wordpress-plugin
% mkdir -p wp-content/plugins/plugin_name/PEAR/
deizel@imac : ~/Development/stackoverflow/12787540-using-pear-xmlrpc2-inside-wordpress-plugin
% cd wp-content/plugins/plugin_name
deizel@imac : ~/Development/stackoverflow/12787540-using-pear-xmlrpc2-inside-wordpress-plugin/wp-content/plugins/plugin_name
@deizel
deizel / travis.yml
Last active October 10, 2015 23:37 — forked from Phillaf/travis.yml
language: php
php:
- 5.5
- 5.6
- 7.0
sudo: false
env: