Skip to content

Instantly share code, notes, and snippets.

@michealbenedict
michealbenedict / LICENSE.txt
Created November 2, 2011 18:24 — forked from jed/LICENSE.txt
write contextual templates
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@michealbenedict
michealbenedict / ruby-class.js
Created November 25, 2011 20:12
Ruby-style classes in ECMAScript 5
var Class = Object.create(null, {
"new": {
"value": function () {
var result = Object.create(this, {
"class": {
"value": this
}
});
result.initialize.apply(result, arguments);
return result;
@michealbenedict
michealbenedict / jquery.ba-tinypubsub.js
Created December 12, 2011 20:37 — forked from cowboy/HEY-YOU.md
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011
* http://benalman.com/
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */
(function($) {
var o = $({});
$.subscribe = function() {
o.on.apply(o, arguments);
// forked from tyfkda's "ぐるぐる" http://jsdo.it/tyfkda/rukS
var FPS = 1;
var canvas = document.getElementById("world");
var ctx = canvas.getContext("2d");
var width = canvas.width;
var height = canvas.height;
var angStep = 0;
@michealbenedict
michealbenedict / application.rb
Created February 2, 2012 19:54 — forked from mcmire/application.rb
Integrating the Logging framework into your Rails 3 app
#-----------------------------------------------------------------------------------------------
# config/application.rb
#-----------------------------------------------------------------------------------------------
require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require(:default, Rails.env) if defined?(Bundler)
# Bring in the Railtie that will set Rails' various logger variables to
# instances of Logging::Logger instead of Rails' built-in ActiveSupport::BufferedLogger.
@michealbenedict
michealbenedict / gist:1812727
Created February 13, 2012 01:58
rails stack
# main packages
sudo apt-get install build-essential libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison
# create new generic deployer account
$ sudo useradd deployer
# add user to a group
$ ##
# add him to sudoers list
$ sudo vi visudoer
<!-- var obj = {
title: "some title",
content: "some content",
tasks: [
{task_name: "abc"},
{task_name: "bcd"}
]
};
var template = ["<h1>{{title}}</h1>"
@michealbenedict
michealbenedict / securing_rails_updates.md
Created March 5, 2012 15:18 — forked from peternixey/securing_rails_updates.md
How Homakov hacked GitHub and how to protect your application

##How Homakov hacked GitHub and the line of code that could have prevented it


Please note this is not posted by the GitHub team or in any way associated with them team. It's simply hosted as a Gist because the markdown formatting is excellent and far clearer than anything I could manage on my personal Tumblr.


@homakov’s explot on GitHub was simple and straightforward. Calling it an attack makes it sound malicious whereas the truth was that GitHub bolted its front door but left the hinges on quick release. Homakov released the hinges, walked in and shouted to anyone who would listen that they had a problem.

@michealbenedict
michealbenedict / build_b2g.markdown
Created March 5, 2012 23:29
Mozilla B2G Build for Crespo4G

Build Mozilla B2G

# remove and clean build
$ make mrproper

# Sync with main repo
$ make sync

# Make Config file for Nexus S 4G

$ make config-nexuss4g

@michealbenedict
michealbenedict / comma-first-var.js
Created March 14, 2012 15:19 — forked from isaacs/comma-first-var.js
A better coding convention for lists and object literals in JavaScript
// See comments below.
// This code sample and justification brought to you by
// Isaac Z. Schlueter, aka isaacs
// standard style
var a = "ape",
b = "bat",
c = "cat",
d = "dog",