Skip to content

Instantly share code, notes, and snippets.

View scottmessinger's full-sized avatar

Scott Ames-Messinger scottmessinger

View GitHub Profile
@peterc
peterc / embedded_document_delete.rb
Created March 13, 2010 02:27
MongoMapper to give EmbeddedDocument a "delete" method
# MongoMapper "embedded document delete" plugin
# By Peter Cooper
#
# Got embedded documents you want to delete? You can delete them as if the
# embedded document collection were an array, but then there's no way to get
# a callback (as far as I could tell). This plugin gives you a call back
# (if you want it) and gives a nicer syntax to deleting embedded docs.
#
# Example:
#
@octplane
octplane / mongo_pubsub.rb
Created November 9, 2010 16:17
Simple Pub/Sub system using MongoDB, capped collections and tailable cursors in ruby
require 'rubygems'
require 'mongo'
module MongoPubSub
QUEUES_COLLECTION = 'queues'
class EndSubscriptionException < Exception; end
class Publisher
def initialize(queue_name, mongo_connection)
# Initialize queue collection as a capped collection
if not mongo_connection[QUEUES_COLLECTION].collection_names.include?(queue_name)
@johnjohndoe
johnjohndoe / .gitignore
Created January 3, 2011 18:04
A git log alias with colors, date and owner.
# A git log alias.
# Shows the brief log describtion in one line.
# Adds colors, a relative date and the owner.
# File name: .gitconfig
[alias]
look = log --graph --pretty=format:'%Cred %h : %Creset%s %Cgreen(%cr) %C(blue)<%an>%C(yellow)%d %Creset' --date=relative
@shimondoodkin
shimondoodkin / WebKit contentEditable focus bug workaround.html
Created July 13, 2011 19:28
WebKit contentEditable focus bug workaround
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>WebKit contentEditable focus bug workaround</title>
<script type='text/javascript' src='http://code.jquery.com/jquery-1.6.2.js'></script>
<script type='text/javascript'>
//<![CDATA[
$(function(){
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@panayi
panayi / gist:2781592
Created May 24, 2012 13:38
Ember.js: Animating view with JQ.Animation mixin
JQ.Animate = Ember.Mixin.create({
cssProperties: ['background', 'backgroundAttachment', 'backgroundColor', 'backgroundImage', 'backgroundPosition',
'backgroundRepeat', 'border', 'borderBottom', 'borderBottomColor', 'borderBottomStyle', 'borderBottomWidth',
'borderColor', 'borderLeft', 'borderLeftColor', 'borderLeftStyle', 'borderLeftWidth', 'borderRight', 'borderRightColor',
'borderRightStyle', 'borderRightWidth', 'borderStyle', 'borderTop', 'borderTopColor', 'borderTopStyle', 'borderTopWidth',
'borderWidth', 'clear', 'clip', 'color', 'cursor', 'display', 'filter', 'font', 'fontFamily', 'fontSize',
'fontVariant', 'fontWeight', 'height', 'left', 'letterSpacing', 'lineHeight', 'listStyle', 'listStyleImage',
'listStylePosition', 'listStyleType', 'margin', 'marginBottom', 'marginLeft', 'marginRight', 'marginTop', 'overflow',
'padding', 'paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop', 'pageBreakAfter', 'pageBreakBefore',
'position', 'styleFloat', 'textAlign', 'textDecoration'
@workmanw
workmanw / Feedback.md
Created July 3, 2012 19:44
Feedback on Ember `VIEW_PRESERVES_CONTEXT`

After a mind numbing week of updating all of the templates in our app and thinking about the implications of this change, I'd like to provide a little bit of feedback on this change.

Overall, I view this change as unfavorable. It's not that I dislike the change, it's that I don't find much value in it and it was a very daunting task to push to Ember users.

Template Simplification

From what I've gathered the purpose of this change is to "significantly reduce the verbosity of templates". I did not find that my templates either grew or shrank in size, they really remained constant. I believe one of the intended ways for reducing size was the elimination for the need of contentBinding="this" on {{view}} helpers. E.g.

{{#each App.photosController}}
@lukemelia
lukemelia / config.ru
Created July 4, 2012 22:06
Example rack app for Ember development
require 'bundler/setup'
require 'sass'
require 'compass'
require 'rake-pipeline'
require 'listen'
require 'rack/lock'
require 'ruby-debug'
require 'securerandom'
require 'ruby_gntp'
@pjlammertyn
pjlammertyn / Ember.Editable.js
Created August 8, 2012 12:51
Ember.Editable mixin
Ember.Editable = Ember.Mixin.create({
_originalPropertyStates: Ember.Map.create(),
_isEditing: false,
willDestroy: function () {
var $this = this;
for (var prop in this.getOwnProperties()) {
Ember.removeBeforeObserver($this, prop, $this, '_beforePropertyChange');
//Ember.removeObserver($this, prop, $this, '_propertyChanged');
}
@go1dfish
go1dfish / array_filter.js
Created October 2, 2012 02:45
Ember.js ArrayProxy based ArrayFilter implementation
Ember.ArrayFilter = Em.ArrayProxy.extend({
init: function() {
this._filterContentDidChange();
this._super();
},
arrangedContent: function() {
var af = this;
return Ember.ArrayFilterSortProxy.create({
arrayFilter: af,