Skip to content

Instantly share code, notes, and snippets.

View betawax's full-sized avatar

Holger Weis betawax

View GitHub Profile
@betawax
betawax / gist:8839887
Created February 6, 2014 07:44
Measure the duration of a request
time curl -s -o /dev/null http://foobar.com
@betawax
betawax / gist:8593627
Created January 24, 2014 07:48
Sync a directory
rsync -a foobar/foo/ foobar/bar
@betawax
betawax / hhvm.hdf
Created January 9, 2014 07:45
Laravel HHVM config
Server {
Port = 8080
SourceRoot = /var/www/foobar/public/
}
VirtualHost {
* {
Pattern = .*
RewriteRules {
* {
@betawax
betawax / gist:7887877
Created December 10, 2013 09:19
Display a image as Base64 data
$data = file_get_contents('foobar.jpg');
echo '<img src="data:image/jpeg;base64,'.base64_encode($data).'" />';
@betawax
betawax / gist:7872141
Created December 9, 2013 13:19
Pass all parameters of one shell script to another
#!/bin/sh
/path/to/script.sh $@
@betawax
betawax / gist:7870111
Created December 9, 2013 10:19
MySQL DATETIME format
Y-m-d H:i:s
@betawax
betawax / fortrabbit.yml
Last active December 30, 2015 08:18
fortrabbit Laravel deployment file
---
version: 1
strategy: fullsync
excludes:
- storage
composer:
mode: always
method: install
@font-face {
font-family: 'Foobar';
font-style: normal;
font-weight: normal;
src: url(../fonts/Foobar-Regular.eot) format('opentype'),
url(../fonts/Foobar-Regular.woff) format('woff'),
url(../fonts/Foobar-Regular.ttf) format('truetype');
}
@font-face {
@betawax
betawax / gist:7560334
Created November 20, 2013 09:32
Laravel file download
$response = Response::make(file_get_contents($path));
$response->header('Content-Type', 'application/octet-stream');
$response->header('Content-Transfer-Encoding', 'binary');
$response->header('Content-Disposition', 'attachment; filename='.basename($path));
$response->header('Content-Length', filesize($path));
@betawax
betawax / gist:7514945
Last active December 28, 2015 14:29
Convert a hexadecimal value to RGB
list($r, $g, $b) = sscanf($hex, '%02x%02x%02x');