Skip to content

Instantly share code, notes, and snippets.

@zamber
zamber / multipass-processing-example.xml
Last active December 17, 2015 03:59
An example of Xalan XSLT 1.0 multi-pass processing of nodes with some nice sorting options (show empty nodes last, case insensitive sort). Load it up in your favorite editor (Intellij IDEA in my case) and play with it :D.
<bookstore>
<book>
<title lang="en">everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price/>
</book>
<book>
@zamber
zamber / preview-shot.js
Last active August 29, 2015 13:58
DalekJS + Anvil -> screenshots for a dir full of .html files
/*
Iterate over the static frontend and make screenshots.
Point Anvil to the prod build dir where index.html is.
*/
// Get IP for ievms + anvil
// https://stackoverflow.com/questions/3653065/get-local-ip-address-in-node-js
var os = require('os');
var ip;
var ifaces = os.networkInterfaces();
/* jshint undef: true, unused: true */
/* global module */
module.exports = function(grunt) {
require('time-grunt')(grunt);
grunt.initConfig({ // task definitions below
// Compile LESS to css.
less: {
@zamber
zamber / analytics.js
Created April 9, 2014 15:28
Track downloads and external links with ga.js
/*
Track downloads and external links with ga.js
Append to your spagetti object container and then just run
self.Analytics.init() at the end of the global init() function.
*/
Analytics: {
init: function () {
var self = this;
@zamber
zamber / varnishlnkfile.te
Last active August 17, 2017 17:00
SELinux: Varnish + reading symlinks in /etc/varnish
module varnishlnkfile 1.0.0;
# The changes linked below did not trigger a version bump so on some systems reading usr_t in .vcl's is restricted
# http://j.mp/selinux-varnish-symlinks
# @gist https://gist.github.com/Zamber/7d82850abf3a17fdd401
require {
type usr_t;
type varnishd_t;
#
# MTSH (MoreTerra Simple Helper) v0.1.0
# PowerShell 3.0
#
# Generate world images from Terraria world with MoreTerra
# Configure and fork it as you see fit.
#
# To schedule it as a task follow this http://j.mp/schedule-powershell
#
# To host it use http://cestana.com/mongoose.shtml
@zamber
zamber / .zshrc
Last active August 29, 2015 14:07
ZSH expanding aliases in emacs mode
################################################################################
# Change java version
################################################################################
function setjdk() {
if [ $# -ne 0 ]; then
removeFromPath '/System/Library/Frameworks/JavaVM.framework/Home/bin'
if [ -n "${JAVA_HOME+x}" ]; then
removeFromPath $JAVA_HOME
fi
@zamber
zamber / README.md
Last active August 29, 2015 14:11
Restore Chrome User Switching UI

Google Chrome just ruined the user switching UI. To restore it:

  1. Go to chrome://flags
  2. Disable #enable-new-profile-management
  3. Enable #enable-fast-user-switching
  4. Disable #enable-new-avatar-menu
@zamber
zamber / Limelight.css
Last active August 29, 2015 14:19
LimeChat - Limelight for ZNC
/*
LimeChat Limelight Theme
Modified for smaller server and status messages. Makes living with ZNC much easier.
*/
html {
font-family: "Dejavu Sans Mono", "Monaco", monospace;
font-size: 9pt;
background-color: #202020;
color: #FFFFFF;
@zamber
zamber / gist:4a2ae25549ac3786fbe2
Last active July 13, 2018 08:59
Merging a Subdirectory from Another Repository.md

Merging a Subdirectory from Another Repository

In this brief guide I'll show you how to copy one directory from one repository to another with the hisotry for it intact.

If you are unsure what you are doing then work on clean clones of your source and target repositories.

Let's get the terminology straight now. We will be going from this state:

  • repo-from
  • tasty-directory