Skip to content

Instantly share code, notes, and snippets.

@dj1020
dj1020 / gist:b0453ed2462436f59d1a
Last active August 29, 2015 14:16
Vagrant file for chgrp to www-data to fix Laravel permission issues.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.network :private_network, ip: "192.168.33.21"
@dj1020
dj1020 / macros.php
Last active August 29, 2015 14:17
Laravel Response extend for inline displaying of images
<?php
Response::macro('inlineImage', function($path, $name = null, $lifetime = 0)
{
if (is_null($name)) {
$name = basename($path);
}
$filetime = filemtime($path);
$etag = md5($filetime . $path);
@dj1020
dj1020 / gist:541b9bcadb6181802847
Created March 21, 2015 06:27
composer install on mac
curl -sS https://getcomposer.org/installer | php -- --filename=composer --install-dir=/usr/local/bin
@dj1020
dj1020 / Gulpfile.js
Last active August 29, 2015 14:17
Gulpfile.js Example for codeception with notification
var gulp = require('gulp');
var notify = require('gulp-notify');
var codecept = require('gulp-codeception');
var _ = require('lodash');
gulp.task('runtest', function() {
var options = testCodeceptOptions('api', 'categoryProductApiCest');
gulp.src('codeception.yml')
.pipe(codecept('./vendor/bin/codecept', options))
.on('error', notify.onError(testNotification('fail', 'codeception')))
@dj1020
dj1020 / gulpfile.js
Created April 7, 2015 04:43
Run codeception test with gulp and automatically open report when test fails
var gulp = require('gulp');
var notify = require('gulp-notify');
var codecept = require('gulp-codeception');
var changed = require('gulp-changed');
var open = require('gulp-open');
var watch = require('gulp-watch');
var debug = require('gulp-debug');
var _ = require('lodash');
gulp.task('runtest', function() {
@dj1020
dj1020 / gulpfile.js
Last active August 29, 2015 14:20 — forked from mikeerickson/gulpfile.js
Gulp with Phpspec edited from Mike Erickson
/* Gulpfile
* Mike Erickson
*/
var gulp = require('gulp'),
notify = require('gulp-notify'),
phpspec = require('gulp-phpspec');
gulp.task('phpspec', function() {
var options = {
var CompactCommand= function(){
var self = this;
this.start = new Date(); // measure running time
this.exec = function(){
printDbStats(); // before dbstats
execCommand();
printDbStats(); // after dbstats
}
this.calcExecTime = function(){
var end = new Date();
@dj1020
dj1020 / gulpfile.js
Created July 23, 2015 02:38
Gulp with PHPUnit simplest config file
var gulp = require('gulp'),
exec = require('child_process').exec,
sys = require('sys'),
util = require('util');
gulp.task('phpunit', function() {
exec('clear', function(error, stdout, stderr){
util.puts(stdout);
exec('phpunit', function(error, stdout) {
sys.puts(stdout);
@dj1020
dj1020 / .vimrc.after
Last active August 29, 2015 14:27
Janus, Jeffrey way .vimrc.after file
set nocompatible " 關閉 vi 相容模式,不太確定做什麼用。和 u,及 insert mode 的方向鍵移動有關。
set t_Co=256
colorscheme xoria256
set guifont=Menlo:h16
set guioptions-=T " Removes top toolbar
set guioptions-=r " Removes right hand scroll bar
set go-=L " Removes left hand scroll bar
set linespace=15
" set lines=25 加了之後 iTerm 會被設成 25 行 >"<
#!/bin/bash
for pkg in `dpkg --get-selections | egrep -v deinstall | awk '{print $1}' | egrep -v '(dpkg|apt|mysql|mythtv)'` ; do apt-get -y install --reinstall $pkg ; done