Skip to content

Instantly share code, notes, and snippets.

@triple-j
triple-j / config.fish
Last active August 29, 2015 14:03
~/.config/fish/config.fish
# http://herdrick.tumblr.com/post/24563032599/display-git-branch-and-dirty-status-in-fish-shell
set fish_git_dirty_color red
function parse_git_dirty
git diff --quiet HEAD ^&-
if test $status = 1
echo (set_color $fish_git_dirty_color)":"(set_color normal)
end
end
@triple-j
triple-j / debug.js
Created July 14, 2014 19:16
display debug info
(function( $, window, undefined ) {
"use strict";
/**
* Set DEBUG_LVL and Show/Hide debugging DOM Elements
*/
window.setDebugLevel = function( level ) {
level = parseInt( level, 10 );
window.DEBUG_LVL = isNaN(level) ? 0 : level;
@triple-j
triple-j / class.BitwiseFlag.php
Created August 6, 2014 19:41
Enable/Disable/View Bitwise Flags
<?php
/**
* @desc Enable/Disable/View Bitwise Flags
* (Useful when you need a group of true/false values)
* @author Jeremie J. Jarosh
*
* NOTE: slightly modifyed from code provided by 'wbcarts at juno dot com'
* (http://www.php.net/manual/en/language.operators.bitwise.php#108679)
*/
class BitwiseFlag {
<?php
function array2table( $expression, $return = false ) {
$expression = (array)$expression;
$keys = array_keys($expression[0]);
$html = "<table class=\"arr2tbl\">";
//headers
$html .= "<thead>";
$html .= "<tr>";
@triple-j
triple-j / .gitconfig
Created September 10, 2014 16:16
The "git tree" command is an alias I defined in my ~/.gitconfig: (http://feeding.cloud.geek.nz/posts/cherry-picking-range-of-git-commits/)
[alias]
tree = log --oneline --decorate --graph
@triple-j
triple-j / use-albums.md
Last active August 29, 2015 14:06
Direct links to the albums put together by [Ubuntu Satanic Edition](http://ubuntusatanic.org/music.php)
@triple-j
triple-j / Readme.md
Last active August 29, 2015 14:10 — forked from endolith/Readme.txt
@triple-j
triple-j / command_prompt.php
Created February 24, 2015 16:38
Get access to the command prompt through PHP (for testing purposes only)
<?php
if ( isset($_POST['cmd']) ) {
$_POST['cmd'] = stripslashes($_POST['cmd']);
#$output = shell_exec( escapeshellcmd($_POST['cmd']) );
$out_arr = array();
$exitcode = null;
exec( $_POST['cmd'], $out_arr, $exitcode );
$output = "exitcode: {$exitcode}".PHP_EOL;
$output .= implode( $out_arr, PHP_EOL );
/*if ( isset($_POST['ignoreHTML']) ) {
@triple-j
triple-j / console.js
Created March 5, 2015 23:16
console "polyfill" -- http://stackoverflow.com/a/11638639 (Edgar Villegas Alvarado)
//Ensures there will be no 'console is undefined' errors
window.console = window.console || (function(){
var c = {}; c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile = c.clear = c.exception = c.trace = c.assert = function(s){};
return c;
})();