Skip to content

Instantly share code, notes, and snippets.

@danmackinlay
danmackinlay / supervisord.sh
Created August 27, 2009 07:07
an init.d script for supervisord
#! /bin/sh
### BEGIN INIT INFO
# Provides: supervisord
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
<?php
error_reporting(E_ALL | E_STRICT);
/**
* To runs this example you will need the UUID PHP Extension http://pecl.php.net/package/uuid
*/
/**
* DomainModel Aggregate root for a Tweet
*
* The Aggregate root tracks all uncommitted events and can have old
* events replayed to it.
@mvrhov
mvrhov / minimum.conf
Created April 13, 2011 08:33
nginx über config
server {
listen 80;
server_name <your.site.com>;
root /var/www/vhosts/<your.site.com>/site/www/;
#site root is redirected to the app boot script
location = / {
try_files @site @site;
}
# add your user to www-data and vise versa
sudo usermod -a -G www-data myusername
sudo usermod -a -G myusername www-data
# override umask in ~/.bashrc and /etc/init.d/apache2
umask 002
#restart
@mattheworiordan
mattheworiordan / gist:1037984
Created June 21, 2011 14:35
Backbone patch to defer update method requests when new create requests are not complete on a model
(function() {
Backbone.Model.prototype._save = Backbone.Model.prototype.save;
Backbone.Model.prototype.save = function(attrs, options) {
var that = this;
if (!options) { options = {}; }
if (this.savingNewRecord) {
// store or replace last PUT request with the latest version, we can safely replace old PUT requests with new ones
// but if there are callbacks from a previous PUT request, we need to make sure they are all called as well
_(['success','error']).each(function(event) {
// convert all callbacks to a single array of callbacks)
@jmarnold
jmarnold / example.js
Created November 10, 2011 16:43
Dependencies in Backbone
Model = Backbone.Model.extend({
initialize: function () {
this.dependentProperty('y', function () {
return this.get('x') * 100;
});
}
});
@cakper
cakper / gist:1386347
Created November 22, 2011 17:47
Build.xml for Symfony2
<?xml version="1.0" encoding="UTF-8"?>
<project name="SS" default="build">
<target name="build"
depends="prepare,lint,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,phpunit,phpcb"/>
<target name="build-parallel"
depends="prepare,lint,tools-parallel,phpunit,phpcb"/>
<target name="tools-parallel"
@beberlei
beberlei / README.md
Created February 8, 2012 08:25
Collection Filters - Readme Driven Development

Filter Language for Collections

Why?

You often need subsets of objects in a collection and want to access them efficiently in your domain model. But you certainly don't want to access the EntityManager or any other object manager here to craft a query. FilterExpressions for collections allow to go back to the database and query for all objects matching the crafted expression. Additionally they also work against in meemory ArrayCollection exactly the same. This way you don't (except for the SQL performance when it haunts you ;)) have to think about the context and can focus on your domain logic.

In Doctrine ORM this will be done by building DQL under the hood, in memory it will be done using Collection#filter(Closure $closure);

Technical Requirements:

@mxriverlynn
mxriverlynn / 1.html
Created April 11, 2012 14:37
modal dialog with backbone
<script id="modal-view-template" type="text/html">
<div class="modal-header">
<h2>This is a modal!</h2>
</div>
<div class="modal-body">
<p>With some content in it!</p>
</div>
<div class="modal-footer">
<button class="btn">cancel</button>
<button class="btn-default">Ok</button>
@mxriverlynn
mxriverlynn / 1.js
Created May 4, 2012 14:40
ajax command wrapper
var signForm = $.ajax({
type: "POST",
url: "/some/form",
dataType: "JSON",
data: myData
});
signForm.done(function(response){
// handle success here
});