Skip to content

Instantly share code, notes, and snippets.

View pietvanzoen's full-sized avatar

Piet van Zoen pietvanzoen

View GitHub Profile
@pietvanzoen
pietvanzoen / .commento_env
Last active June 11, 2020 13:44
Setting up Commento as a systemd service
COMMENTO_PORT=9000
COMMENTO_DATABASE_FILE=/var/commento/commento.db
AKISMET_KEY=<your-akismet-key>
@pietvanzoen
pietvanzoen / README.md
Last active December 1, 2018 08:07
A tool for cloning and automatically organising local git repos.

Git get

Like go get, git-get organizes repos in directories according to 1) host, 2) user, and 3) project name.

Example

git get git@github.com:pietvanzoen/dotfiles.git will clone the project into $GIT_PATH/github.com/pietvanzoen/dotfiles.

Installation

@pietvanzoen
pietvanzoen / node_dev_list.sh
Last active November 10, 2017 13:39
Create a list of all production dependency npm urls for the current node project.
#!/bin/bash
# Returns a list of all unique production dependencies for the current node project.
if [[ ! -f package.json ]]; then
echo "Not a node project"
exit 1
fi
npm list --prod |
head -n -2 |
@pietvanzoen
pietvanzoen / Numberstowords.php
Created July 8, 2013 17:05
Numbers to words :: A php library for converting numbers to words. Useful for bio copy that includes years since an event. Also useful for dynamically rendering grid systems that use words such as class="columns six". #php
<?php
// Goes in codeigniter/libraries
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Numbertowords {
function convert_number($number) {
if (($number < 0) || ($number > 999999999)) {
@pietvanzoen
pietvanzoen / README.md
Last active August 31, 2017 12:10
Git annotated tag release script

Git annotated tag release script

Install

cd <where-you-want-to-run-your-script-from>
curl -O https://gist.githubusercontent.com/pietvanzoen/40dd1bb43bcf49223532a4beb941c384/raw/git-release.sh
chmod +x git-release.sh

Keybase proof

I hereby claim:

  • I am pietvanzoen on github.
  • I am pietvanzoen (https://keybase.io/pietvanzoen) on keybase.
  • I have a public key ASBpau9eiT0n4A_JsFaaI7N3YxFkXl65sVihMr03vSZd8Qo

To claim this, I am signing this object:

@pietvanzoen
pietvanzoen / circle.yml
Last active October 31, 2016 21:51
Using Yarn in CircleCI
dependencies:
pre:
- ./install-yarn.sh
cache_directories:
- ~/.yarn
- ~/.yarn-cache
override:
- yarn install
@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 / 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 / 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;
});