Skip to content

Instantly share code, notes, and snippets.

View chrisramakers's full-sized avatar
🤘

Chris Ramakers chrisramakers

🤘
View GitHub Profile
@chrisramakers
chrisramakers / chris.zsh-theme
Last active January 10, 2019 13:10
My ZSH theme
if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
function gittop() {
local GITDIR=`git rev-parse --show-toplevel` 2> /dev/null
if [ $GITDIR ]; then
echo "$(basename $GITDIR) "
fi
}
@chrisramakers
chrisramakers / tmuxcheatsheet.md
Created November 9, 2016 09:14
Tmux cheat sheet

Tmux Cheat sheet

Tmux

tmux            Start new session
tmux a          Re-attach session
tmux a -t foo   Re-attach session named foo
tmux ls         List all sessions

General

d Detach
// Coffeescript
foo = (x) -> { 2 * x }
<?php
// Verbose syntax for Closure
function ($x) {
return $x * 2;
}
// Short Closure Syntax
$x ~> $x * 2
<?php
include_once './vendor/autoload.php';
function accountExists($name){
$soapClient = new \Zimbra\ZCS\SoapClient("host", "port", "username", "password");
$admin = new \Zimbra\ZCS\Admin\Account($soapClient);
try {
// Fetch account by name, if it exists return it
$accountEntity = $admin->getAccount($name, 'name');

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@chrisramakers
chrisramakers / xdebug
Created December 19, 2012 12:54
Xdebug configuration for vagrant/phpstorm
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_port=9000
xdebug.remote_connect_back=on
xdebug.remote_autostart=on
xdebug.idekey=vagrant
@chrisramakers
chrisramakers / expandtabs.sh
Created July 15, 2011 07:27
Expands the tabs on all files matching a find-command argument
#!/bin/bash
# Author: Chris Ramakers <chris@inventis.be>
# Bash script to replace all tabs with spaces through the expand shell command
# For more info on expand run "man expand"
# Special thanks to bmk on Stackoverflow
# http://stackoverflow.com/questions/6677441/run-expand-on-find-results/6683317#6683317
# This script accepts 2 arguments
@chrisramakers
chrisramakers / gist:1010321
Created June 6, 2011 14:04
List all crontabs defined in a system
for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done
@chrisramakers
chrisramakers / .rsyncignore
Created June 6, 2011 13:26 — forked from walt/.rsyncignore
Deploy using rsync
.DS_Store
.svn/
/path/to/app/cache/*