Skip to content

Instantly share code, notes, and snippets.

View pietvanzoen's full-sized avatar

Piet van Zoen pietvanzoen

View GitHub Profile
@pietvanzoen
pietvanzoen / .ps1_functions
Created May 12, 2014 22:48
ps1 functions
#!/usr/bin/env bash
#
# Source this file in your ~/.bash_profile or interactive startup file.
# This is done like so:
#
# [[ -s "$HOME/.rvm/contrib/ps1_functions" ]] &&
# source "$HOME/.rvm/contrib/ps1_functions"
#
# Then in order to set your prompt you simply do the following for example
@pietvanzoen
pietvanzoen / .bash_profile
Last active August 29, 2015 14:01
Using ENV variables
export WIBBLE=woo
@pietvanzoen
pietvanzoen / find_in_files_goto.py
Created May 20, 2014 22:46
Sublime Text Plugin - goto file/line from "Find Results" page by hitting ENTER. Based on this stack overflow answer: http://stackoverflow.com/a/16779397
# Add this file to your Sublime Packages/User folder
import sublime
import sublime_plugin
import re
import os
class FindInFilesGotoCommand(sublime_plugin.TextCommand):
def run(self, edit):
view = self.view
if view.name() == "Find Results":
@pietvanzoen
pietvanzoen / list-git-branches.sh
Last active August 29, 2015 14:02
List current branch in multiple repos and show status. Optionally pass `-f` or `--fetch` to run a fetch on each branch first.
#!/bin/bash
# root repo folder
REPOROOT="$HOME/Projects"
# folder search glob
REPOGLOB="cozy[-_]*"
OUTDATA=""
fetch_msg="Fetching.."
@pietvanzoen
pietvanzoen / slack_monokia_theme
Created August 8, 2014 20:33
Monokia theme for slack
#222222,#2F2F2F,#F92772,#FFFFFF,#A6E22D,#FFFFFF,#66D9EF,#BE84F2
@pietvanzoen
pietvanzoen / Preferences.sublime-settings
Created February 5, 2015 22:51
Piet's sublime settings.
{
"additional_path_items":
[
"/usr/local/Cellar/git/2.1.2/libexec/git-core"
],
"animation_enabled": false,
"binary_file_patterns":
[
"*.jpg",
"*.jpeg",
@pietvanzoen
pietvanzoen / Default (OSX).sublime-keymap
Created February 5, 2015 23:00
Piet's sublime keybindings.
[
// Simplify command pallet
{
"keys": ["super+p"], "command": "show_overlay",
"args": {"overlay": "command_palette"} ,
"context": [ { "key": "overlay_visible", "operand": false }
},
// Join lines
@pietvanzoen
pietvanzoen / array_group.php
Created July 8, 2013 17:10
Array_group :: Divide an array into groups. #php
<?php
/**
* Returns an array of arrays.
*
* $array - an array to be divided
* $groups - number of groups to divide the array into
*/
function array_group($array, $groups)
{
@pietvanzoen
pietvanzoen / placeholders.php
Created July 8, 2013 17:11
Image Placeholders :: Helper functions for placeholder image services such as http://Placehold.it and http://Placekitten.com. #php
<?php
// http://placehold.it
function placeholdit($width = 100, $height = '', $text = '', $colors = '')
{
$dimentions = $width.( !empty($height) ? 'x'.$height : '');
$text = !empty($text) ? '&text='.urlencode($text) : '';
$colors = !empty($colors) ? explode(' ', $colors) : '';
$colors = !empty($colors) ? '/'.$colors[0].'/'.$colors[1] : '';
return 'http://placehold.it/'.$dimentions.$colors.$text;
}
@pietvanzoen
pietvanzoen / get_excerpt_stripped.php
Created July 9, 2013 20:35
Get_excerpt_stripped :: Record model method for Fuelcms modules to look for record excerpt, strip tags and set character. If no excerpt is found record content is used instead. #fuel
<?php
function get_excerpt_stripped($char_limit = NULL)
{
$this->_CI->load->helper('text');
$excerpt = (empty($this->excerpt)) ? $this->content : $this->excerpt;
// must strip tags to get accruate character count
$excerpt = strip_tags($excerpt);
if (!empty($char_limit))
{