Skip to content

Instantly share code, notes, and snippets.

View zwacky's full-sized avatar

Simon zwacky

View GitHub Profile
@zwacky
zwacky / implode_assoc_array.php
Created June 6, 2013 09:23
implode() an associative array
implode(', ', array_map(
function ($k, $v) { return "{$k}: {$v}"; },
array_keys($array),
array_values($array)
));
@zwacky
zwacky / create-git-repo.sh
Created June 7, 2013 08:01
creates a bare git repository with two branches (master, develop) in it, ready to be commited onto.
#!/bin/bash
# shell script to create git repositories
if [ $# -ne 1 ] ; then
echo "usage: create-git REPONAME"
echo "=> example: create-git myrepo"
exit
fi
cd ~/git
@zwacky
zwacky / viewport.tmpl.html
Created July 17, 2013 07:43
viewport setup to correctly handle orientation changes on mobile devices, also disabling scaling/pinching
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
@zwacky
zwacky / bash-custom-prompt.sh
Created March 1, 2014 14:01
beautified bash custom prompt
# add to ~/.bashrc
export PS1='\[\033[0;35m\]\h\[\033[0;33m\] \w\[\033[00m\]: '
@zwacky
zwacky / better-git-log.sh
Created March 4, 2014 10:15
Beautified and better git log history output
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --"
# usage: git lg
@zwacky
zwacky / gulpfile.js
Last active June 5, 2020 22:57
Example gulpfile.js to get it going with LESS and AngularJS
var gulp = require('gulp');
var plugins = require('gulp-load-plugins')();
var rimraf = require('rimraf');
var paths = {
less: ['./less/*.less'],
js: ['./js/app/*.js', './js/app/**/*.js'],
jsView: ['./js/app/views/*.html'],
dist: {
css: './public/css/',
@zwacky
zwacky / package.json
Created September 20, 2014 16:47
general-gulp-file
{
"name": "general-gulp-file",
"version": "0.1.0",
"devDependencies": {
"gulp": "*",
"gulp-load-plugins": "*",
"multipipe": "*",
"gulp-less": "*",
"gulp-concat": "*",
"gulp-uglify": "*",
/* TINY DEVICES (tn) */
@media (max-width: 479px) {
}
/* EXTRA SMALL DEVICES (phones) */
@media (max-width: 767px) {
}
/* declaration */
@size-tn: ~"(max-width: 479px)";
@size-xs: ~"(min-width: 480px) and (max-width: 767px)";
@size-sm: ~"(min-width: 768px) and (max-width: 991px)";
@size-md: ~"(min-width: 992px) and (max-width: 1199px)";
@size-lg: ~"(min-width: 1200px)";
/* example usage */
footer {
@media @size-xs {
@zwacky
zwacky / clear-cache.sh
Created October 22, 2014 14:50
clear cache on apache mod_pagespeed
touch /var/cache/mod_pagespeed/cache.flush