Skip to content

Instantly share code, notes, and snippets.

@jordantomax
jordantomax / controllers.js
Last active September 11, 2015 18:55
Angular ng-repeat and overlays
var app = angular.module('app', [])
.directive('onFinishRender', function($timeout) {
return {
link: function(scope, element, attr) {
if (scope.$last === true) {
$timeout(function() {
scope.$emit('renderFinished');
})
}
}
/Users/jordancooperman/.meteor/packages/meteor-tool/.1.1.3.16z1zvh++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
W20150729-14:25:20.389(-4)? (STDERR) throw(ex);
W20150729-14:25:20.389(-4)? (STDERR) ^
W20150729-14:25:20.389(-4)? (STDERR) Error: A method named '/collegeofficers/insert' is already defined
@jordantomax
jordantomax / font-face-weights
Created November 24, 2014 18:38
Use the same font family name with different weights
@font-face {
font-family: 'Foo';
font-weight: normal;
src: url(./fonts/FooRegular.woff) format('woff');
}
@font-face {
font-family: 'Foo';
font-weight: bold;
src: url(./fonts/FooBold.woff) format('woff');
}
task :update_images => :environment do
WorkImage.all.each do |model|
if model.image.present?
model.image.recreate_versions!
model.save
end
end
end
class ImageUploader < CarrierWave::Uploader::Base
include CarrierWave::RMagick
storage :file
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
@jordantomax
jordantomax / gist:5486251
Created April 30, 2013 02:20
vagrant up error
vagrant up
There were warnings and/or errors while loading your Vagrantfile.
Your Vagrantfile was written for an earlier version of Vagrant,
and while Vagrant does the best it can to remain backwards
compatible, there are some cases where things have changed
significantly enough to warrant a message. These messages are
shown below.
Warnings:
* `config.vm.customize` calls are VirtualBox-specific. If you're
@jordantomax
jordantomax / Handlebars foreach helper
Last active December 16, 2015 13:18
Handlebars foreach helper with index, first, last and support for string primitives
Handlebars.registerHelper("foreach",function(arr,options) {
if (options.inverse && !arr.length) {
return options.inverse(this);
}
return arr.map(function(item,index) {
if (typeof item === 'string') {
var item = new String(item);
}
@jordantomax
jordantomax / Backbone Forms custom editor example
Created August 28, 2012 19:01
Backbone Forms custom editor example for sure with powmedia backbone-forms plugin
MyProject.Form.editors = {
MultipleSelect: Backbone.Form.editors.Select.extend({
render: function() {
this.setOptions(this.schema.options);
this.$el.attr('multiple', 'multiple');
return this;
},
})
1109 /Users/jordancooperman/.rvm/gems/ruby-1.9.3-p0@thecoopermen/gems/coffee-rails-3.1.1/lib/coffee/rails/railtie.rb
1110 /Users/jordancooperman/.rvm/gems/ruby-1.9.3-p0@thecoopermen/gems/coffee-rails-3.1.1/lib/coffee/rails/template_handler.rb
1111 /Users/jordancooperman/.rvm/gems/ruby-1.9.3-p0@thecoopermen/gems/coffee-rails-3.1.1/lib/coffee/rails/version.rb
1112 /Users/jordancooperman/.rvm/gems/ruby-1.9.3-p0@thecoopermen/gems/coffee-rails-3.1.1/lib/coffee-rails.rb
1113 /Users/jordancooperman/.rvm/gems/ruby-1.9.3-p0@thecoopermen/gems/uglifier-1.2.1/lib/uglifier.rb
1114 /Users/jordancooperman/.rvm/gems/ruby-1.9.3-p0@thecoopermen/gems/sqlite3-1.3.5/lib/sqlite3/sqlite3_native.bundle
1115 /Users/jordancooperman/.rvm/gems/ruby-1.9.3-p0@thecoopermen/gems/sqlite3-1.3.5/lib/sqlite3/constants.rb
1116 /Users/jordancooperman/.rvm/gems/ruby-1.9.3-p0@thecoopermen/gems/sqlite3-1.3.5/lib/sqlite3/errors.rb
1117 /Users/jordancooperman/.rvm/gems/ruby-1.9.3-p0@thecoopermen/gems/sqlite3-1.3.5/lib/sqlite3/pragmas.rb
1118
<?
$thisChannel = 'news';
$thisPage = 'corporate';
$thisSubPage = 'advertise';
$thisSubPageTab = 'audience';
?>
<!DOCTYPE html>
<html>