Skip to content

Instantly share code, notes, and snippets.

@kohenkatz
kohenkatz / README.md
Created March 24, 2014 04:02
How to run Dada Mail under nginx

#Dada Mail (or any other CGI) on Nginx

DISCLAIMER: DO NOT rely on this for production (yet)! I'm not done testing it out.

Nginx does not have built in support for traditional CGI applications (of which Dada Mail is one), so it won't work out of the box.

To make a very long story short, here are a Plack wrapper script and nginx configuration that I have found seem to work.

Notes:

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'
#!/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'
@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) {
@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 / 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 / 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):
<?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 / 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

@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,