Skip to content

Instantly share code, notes, and snippets.

Product.joins(:brand).where(brand: {id: 1})
@mb-dev
mb-dev / simple_form_error_render.js.coffee
Created April 3, 2013 21:54
Simple Form error rendering
form_prefix = 'chapter'
@activeView.$el.find('.help-inline').remove()
@activeView.$el.find('.control-group').removeClass('error')
if(data.errors and data.errors.messages and _(data.errors.messages).keys().length > 0)
_(data.errors.messages).each (value, key, list) =>
@activeView.$el.find('#' + form_prefix + '_' + key).closest('.control-group').addClass('error')
$('<span class="help-inline">' + value + '</span>').insertAfter(@activeView.$el.find('#' + form_prefix + '_' + key))
@mb-dev
mb-dev / Gemfile
Created April 25, 2013 02:19
Chef Gemfile
gem 'chef', '10.16.2'
gem 'knife-solo'
gem 'knife-solo_data_bag'
gem 'librarian'
gem 'ffi', '~> 1.2.0'
gem 'vagrant', "~> 1.0.5"
gem 'multi_json'
@mb-dev
mb-dev / command.sh
Last active December 16, 2015 15:39
Getting started
bundle
knife solo init .
librarian-chef init
librarian-chef install
vagrant box add quantal64 http://static.aldoborrero.com/vagrant/quantal64.box
vagrant init quantal64
vagrant up
@mb-dev
mb-dev / Cheffile
Created April 25, 2013 02:26
Cookbooks
cookbook 'apt', '1.7.0'
cookbook 'apache2', '>= 1.0.0'
cookbook 'rvm', :git => 'https://github.com/fnichol/chef-rvm'
cookbook 'git', git: 'https://github.com/fnichol/chef-git.git'
cookbook 'redisio'
cookbook 'mysql'
cookbook 'ruby_build', '0.7.2'
cookbook 'firewall'
cookbook 'ssh_known_hosts'
cookbook 'mongodb', git: 'git://github.com/higanworks-cookbooks/mongodb-10gen.git'
config.vm.box = "quantal64"
VAGRANT_JSON = MultiJson.load(Pathname(__FILE__).dirname.join('nodes', 'localhost.json').read)
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = ["site-cookbooks", "cookbooks"]
chef.roles_path = "roles"
chef.data_bags_path = "data_bags"
chef.provisioning_path = "/tmp/vagrant-chef"
chef.encrypted_data_bag_secret_key_path = "./data_bag_key"
var app = require('http').createServer(handler)
, io = require('socket.io').listen(app)
, fs = require('fs')
var config = require('./settings.js')
app.listen(config.port);
function handler (req, res) {
fs.readFile(__dirname + '/index.html',
@function pxtoem($pxval, $base: 14) {
@if (unitless($pxval)) {
$pxval: $pxval * 1px;
}
@if (unitless($base)) {
$base: $base * 1px;
}
@return $pxval / $base * 1em;
_.mixin
try: (object, property) ->
if object? then object[property] else null
isBlank: (str) ->
(!str || /^\s*$/.test(str))
@mb-dev
mb-dev / gist:3feb7e2b98f1867fde52
Last active August 29, 2015 14:03
Jewish Film Festival

Anywhere else:

![Anywhere else][1] A graduate student in Berlin, Noa seems to be on the right track: She has almost completed her thesis and has just moved in with her German musician boyfriend, Jörg. But when her grant application is turned down, and her advisor deems her project—a dictionary of words that defy translation—unsuitable, all the pressures of living in a foreign country far away from her native Israel are too much for the already stressed-out Noa to handle... http://prod3.agileticketing.net/websales/pages/info.aspx?evtinfo=82364~a70858c6-cd47-4e92-968c-c94c12db6b1c

Site: http://prod3.agileticketing.net/websales/pages/info.aspx?evtinfo=82364~a70858c6-cd47-4e92-968c-c94c12db6b1c& Trailer: https://www.youtube.com/watch?v=bFsIksu6Rz4

  • Castro Theatre - Tue, Jul 29 1:45 PM