Skip to content

Instantly share code, notes, and snippets.

@zilkey
zilkey / ember-precompile.js
Created March 10, 2012 22:30 — forked from garth/Jakefile.js
Precompile .handlebars templates with node js
var fs = require('fs');
var vm = require('vm');
var emberjs = fs.readFileSync('public/javascripts/vendor/ember-0.9.5.min.js', 'utf8');
var templatesDir = 'templates';
var destinationDir = 'public/javascripts/templates';
function compileHandlebarsTemplate(templatesDir, fileName) {
var file = templatesDir + '/' + fileName;
@kevinansfield
kevinansfield / 20111218135715_globalize_models.rb
Created December 21, 2011 12:17
Globalize3 support with tabs in Active Admin
# db/migrate/20111218135715_globalize_models.rb
class GlobalizeModels < ActiveRecord::Migration
def up
NewsItem.create_translation_table!(
{:title => :string, :body => :text},
{:migrate_data => true}
)
end
@joewest
joewest / app.js
Created December 14, 2011 16:17
ember.js login form
App = Ember.Application.create({});
App.loginController = Ember.Object.create({
// do login stuff
});
App.LoginFormView = Ember.View.extend({
login: null,
password: null,
@taxilian
taxilian / DialogManager.h
Created November 15, 2011 22:58
DialogManager abstraction for FireBreath
#ifndef DialogManager_h__
#define DialogManager_h__
#include <boost/noncopyable.hpp>
#include <boost/function.hpp>
#include "BrowserHost.h"
typedef boost::function<void (const std::string&)> PathCallback;
namespace FB { class PluginWindow; }
@ChrisWills
ChrisWills / .screenrc-main-example
Created November 3, 2011 17:50
A nice default screenrc
# GNU Screen - main configuration file
# All other .screenrc files will source this file to inherit settings.
# Author: Christian Wills - [email protected]
# Allow bold colors - necessary for some reason
attrcolor b ".I"
# Tell screen how to set colors. AB = background, AF=foreground
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
@watson
watson / ability.rb
Created October 5, 2011 09:50
Active Admin CanCan integration with shared front/backend User model and multi-level autherization
# app/models/ability.rb
# All front end users are authorized using this class
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new
can :read, :all
@loonies
loonies / 1_phpunit-api.md
Last active August 30, 2025 20:18
PHPUnit Cheat Sheet

PHPUnit API reference

  • version 3.6

TODO

Check those constraints:

$this-&gt;anything()
@autch
autch / vcgi.rb
Created August 23, 2011 04:41
ERB/CGI/PHP-capable WEBrick server
#!/usr/bin/ruby
ORG_ARGV = ARGV.dup
require 'optparse'
require 'socket'
BasicSocket.do_not_reverse_lookup = true
require 'webrick'