Skip to content

Instantly share code, notes, and snippets.

@kohenkatz
kohenkatz / git-completion.tcsh
Created April 5, 2012 18:30
Source this file in your .tcshrc to get git command completion. Original source is http://gtirtha.wordpress.com/2010/05/14/git-autocomplete/ but WordPress's WSYIWYG editor messed it up and I cleaned it up.
# Source this script in tcsh to setup shell completions
# for git. Completions are activated by typing or Control-D
# in the shell after entering a partial command.
#
# Usage:
# source git-completion.tcsh (e.g. in ~/.cshrc)
#
# Supported completions:
# git (lists git commands)
# git help (lists git commands)
@kohenkatz
kohenkatz / aloha-config.js
Created September 4, 2012 15:07 — forked from evo42/aloha-config.js
Aloha Editor -- send content via ajax to a backend php script to save the data edited with Aloha Editor
( function ( window, undefined ) {
var Aloha = window.Aloha || ( window.Aloha = {} );
Aloha.settings = {
logLevels: { 'error': true, 'warn': true, 'info': true, 'debug': false, 'deprecated': true },
errorhandling: false,
ribbon: false,
locale: 'en',
floatingmenu: {
width: 630,
@kohenkatz
kohenkatz / broken command transcript.md
Created November 15, 2012 05:18
Github SVN errors with bobthecow/mustache.php

SVN Traffic Capture (via Fiddler2 Proxy) of erroring command

Request

OPTIONS /bobthecow/mustache.php HTTP/1.1
User-Agent: SVN/1.7.7 neon/0.29.6
Connection: TE

TE: trailers

<?php defined('SYSPATH') OR die('No direct access allowed.');
class Model_ActionPlan extends Mongo_Document
{
/**
* The name of the collection within the database.
*
* @var string
*/
protected $name;
@kohenkatz
kohenkatz / gist:4353369
Last active December 10, 2015 00:48
Stack Trace
2012-12-10 14:48:44 --- CRITICAL: ErrorException [ 8 ]: Undefined property: Model_ActionPlan::$status ~ MODPATH\baloo\classes\Model\ActionPlan.php [ 78 ] in <APP DIRECTORY>\modules\baloo\classes\Model\ActionPlan.php:78
2012-12-10 14:48:44 --- DEBUG: #0 C:\Web\CMSC435-game\branches\gameplay\modules\baloo\classes\Model\ActionPlan.php(78): Kohana_Core::error_handler(8, 'Undefined prope...', 'C:\Web\CMSC435-...', 78, Array)
#1 <APP DIRECTORY>\modules\baloo\classes\Model\ActionPlan.php(32): Model_ActionPlan->close(Object(Model_Game), Object(Model_User), 'failure')
#2 <APP DIRECTORY>\modules\mongodb\classes\Mongo\Document.php(868): Model_ActionPlan->after_load()
#3 <APP DIRECTORY>\modules\mongodb\classes\Mongo\Document.php(992): Mongo_Document->load_values(Array, true)
#4 <APP DIRECTORY>\modules\mongodb\classes\Mongo\Document.php(561): Mongo_Document->load()
#5 <APP DIRECTORY>\modules\baloo\classes\Model\Question.php(285): Mongo_Document->__get('status')
#6 <APP DIRECTORY>\modules\baloo\classes\Model\Game.php(68):
@kohenkatz
kohenkatz / EchoServer.groovy
Created August 13, 2013 03:04
"Simple" Multi-threaded Echo server example in Groovy.
public class SimpleEchoServer implements Runnable {
private int port;
private LinkedList<Socket> openClients = new LinkedList<Socket>();
private boolean cleaningUp = false;
public SimpleEchoServer(int port) {
this.port = port;
}
@kohenkatz
kohenkatz / install-ruby2.sh
Created August 19, 2013 02:11
How to install Ruby 2.0.0 on Ubuntu
# Install the prereqs.
sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl git-core openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev
# Make sure there are no old versions lying around...
sudo apt-get remove -y ruby1.8 ruby1.9.1 ruby-1.9.3
mkdir /tmp/ruby && cd /tmp/ruby
curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz | tar xz
cd ruby-2.0.0-p247
./configure
@kohenkatz
kohenkatz / main.js
Created October 9, 2013 16:26
How to use jQuery Timeago (http://timeago.yarp.com/) plugin in Durandal. I put this code in my `main.js` file (after the plugin initialization), but there's probably a better place (a plugin file, or similar).
composition.addBindingHandler('timeago',{
init: function(element, valueAccessor) {
var value = ko.utils.unwrapObservable(valueAccessor());
var $this = $(element);
$this.attr($.timeago.isTime($this) ? 'datetime' : 'title', value);
$this.timeago();
},
update: function(element, valueAccessor) {
#!/bin/bash
# Put this file at: .git/hooks/post-checkout
# and make it executable
# You can install it system wide too, see http://stackoverflow.com/a/2293578/685587
PREV_COMMIT=$1
POST_COMMIT=$2
NOCOLOR='\e[0m'
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index 59075ab..c2af1b1 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -2,10 +2,16 @@
.row
.col-md-9
- = render "events/event_last_push", event: @last_push
- = render 'shared/event_filter'