Skip to content

Instantly share code, notes, and snippets.

View StanAngeloff's full-sized avatar

Stan Angeloff StanAngeloff

View GitHub Profile
@StanAngeloff
StanAngeloff / provision.sh
Created April 27, 2012 15:03
Quick and dirty Apache + PHP 4.4.x provisioning for Vagrant/Ubuntu 10.04
#!/usr/bin/env bash
set -e
PHP_VERSION='4.4.9'
MYSQL_DBNAME="$1"
# {{{ Functions
# Perform an unattended installation of package(s).
--- a/installer.vim 2012-04-20 12:23:31.062007345 +0300
+++ b/installer.vim 2012-04-20 12:23:26.338007445 +0300
@@ -201,50 +201,65 @@
endf
func! s:sync(bang, bundle) abort
+ call s:log('')
+ call s:log('Bundle '.a:bundle.name_spec)
+
let git_dir = expand(a:bundle.path().'/.git/', 1)
@StanAngeloff
StanAngeloff / simple-imagediff.py
Created February 1, 2012 11:45
Simple Image Diff for Git
#!/usr/bin/env python
# Simple Image Diffs
# ==================
#
# How to Install
# --------------
#
# Download the script somewhere on $PATH as 'simple-imagediff' with +x:
#
#page :matches(h1, h2, h3, h4, h5, h6) a { color: red; }
// compiles down to
#page h1 a,
#page h2 a,
#page h3 a,
#page h4 a,
#page h5 a,
#page h6 a { color: red; }
.my-button {
border-radius: 10px;
}
#page .my-button a {
color: red;
}
@StanAngeloff
StanAngeloff / index.js
Created November 21, 2011 20:09
Getters/Setters
var object = {
_property: 10,
// Getter/Setter
property: function(value) {
if (typeof (value) === 'undefined') {
return this._property;
}
this._property = value;
@StanAngeloff
StanAngeloff / blocks.php
Created November 1, 2011 16:58
Awesome block commenting technique
<?php
/* DEBUG:
$debug_is_disabled = fn();
//*/
"extra slash before /* DEBUG: to enable block.";
@StanAngeloff
StanAngeloff / print-1.php
Created September 23, 2011 15:38
PHP static wierdness
<?php
# Example with function
function print_first_value(&$value)
{
static $keep = NULL;
if ($keep === NULL) {
print "Setting $value.\n";
$keep = &$value; # NOTE: using $value by reference
}
#!/bin/bash
# Copyright (C) 2011 Bumblebee Project
#
# This file is part of Bumblebee.
#
# Bumblebee is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@StanAngeloff
StanAngeloff / tinylist.js
Created August 1, 2011 18:41
A very tiny Lisp-like implementation in JavaScript
// Based on http://www.flownet.com/ron/lisp/l.py
//
this.TinyLisp = (function(code, env) {
function reduce(array, block) {
var previous = array[0];
for (var i = 1, length = array.length - 1; i < length; i ++) {
previous = block(array[i], previous);
}