Skip to content

Instantly share code, notes, and snippets.

View pietvanzoen's full-sized avatar

Piet van Zoen pietvanzoen

View GitHub Profile
@pietvanzoen
pietvanzoen / youtube_placeholder.js
Created September 6, 2013 22:45
Youtube Helper :: Helper function constructs a placeholder with a video still image from youtube. On click the placeholder is replaced by the youtube iframe. #php
$('.js-loadvideo').on('click', function(e){
e.preventDefault();
var $vid_id = $(this).attr('href').split('v=')[1];
var width = $(this).attr('data-width');
var height = $(this).attr('data-height');
var $video = '<iframe width="'+width+'" height="'+height+'" src="//www.youtube-nocookie.com/embed/'+ $vid_id +'?rel=0&showinfo=0&wmode=opaque&autoplay=1&modestbranding=1" frameborder="0" allowfullscreen></iframe>';
$(this).parent('.playoverlay').html($video);
return false;
});
@pietvanzoen
pietvanzoen / collapser.js
Created October 11, 2013 18:56
Accordion / Collapser Javascript
var $collapseToggle = $('.js_collapse_toggle'),
$collapseContent = $('.js_collapse_content');
$collapseContent.hide();
$collapseToggle.on('click', function(event) {
event.preventDefault();
$(this).toggleClass('collapse_active');
$($(this).attr('href')+'.js_collapse_content').stop(true, false).slideToggle();
});
@pietvanzoen
pietvanzoen / timecop.php
Last active December 25, 2015 07:49
Time Cop
// Returns TRUE when time() is greater than $datatime_string
function time_cop($datetime_string = '3/27/2013 6AM')
{
if (empty($datetime_string)) {
return FALSE;
}
return time() >= strtotime($datetime_string);
}
@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