Skip to content

Instantly share code, notes, and snippets.

View ivoreis's full-sized avatar
🎯
Focusing

Ivo Reis ivoreis

🎯
Focusing
  • London, UK
View GitHub Profile
@ivoreis
ivoreis / mongoid-error
Created September 24, 2012 14:35
Error mongoid - polymorphic
NameError: uninitialized constant Product
from /home/dasssss/.rvm/gems/ruby-1.9.3-p0@global/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:230:in `block in constantize'
from /home/dasssss/.rvm/gems/ruby-1.9.3-p0@global/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:229:in `each'
from /home/dasssss/.rvm/gems/ruby-1.9.3-p0@global/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:229:in `constantize'
from /home/dasssss/.rvm/gems/ruby-1.9.3-p0@global/gems/activesupport-3.2.8/lib/active_support/core_ext/string/inflections.rb:54:in `constantize'
from /home/dasssss/.rvm/gems/ruby-1.9.3-p0@2mato/gems/mongoid-3.0.6/lib/mongoid/relations/metadata.rb:606:in `klass'
from /home/dasssss/.rvm/gems/ruby-1.9.3-p0@2mato/gems/mongoid-3.0.6/lib/mongoid/relations/proxy.rb:21:in `klass'
from /home/dasssss/.rvm/gems/ruby-1.9.3-p0@2mato/gems/mongoid-3.0.6/lib/mongoid/relations/referenced/one.rb:21:in `block in initialize'
from /home/dasssss/.rvm/gems/ruby-1.9.3-p0@2mato/gems
@ivoreis
ivoreis / MediaQueries
Created August 19, 2012 15:53
Common media queries for screens
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
/**
* @application
* @file /app/helpers/models.js
**/
Spine.Model.extend({
toJSON: function(){
var attributes = this.attributes();
attributes['id'] = attributes['_id'];
return attributes;
@ivoreis
ivoreis / grid.styl
Created August 19, 2012 00:43 — forked from jokull/grid.styl
Stylus Skeleton responsive grid
// Based on getskeleton.com
@import "nib/clearfix"
@import "nib/reset"
global-reset()
columns = 16
column-width = 57px // Ends up as 1232px layout
gutter-width = 20px
@ivoreis
ivoreis / example.styl
Created August 19, 2012 00:32 — forked from balupton/README.md
Responsive layouts in stylus
// Responsive layouts in stylus
// https://gist.github.com/1549029
// Created by Benjamin Lupton
// Licensed under the Creative Commons Zero - http://creativecommons.org/publicdomain/zero/1.0/
// ====================================
// Imports
// Nib
@import 'nib'
@ivoreis
ivoreis / i18n.coffee
Created August 12, 2012 19:22 — forked from madrobby/i18n.coffee
Backbone i18n with CoffeeScript
# before this file is loaded, a locale should be set:
#
# In a browser environment, you can use:
# ```<script>__locale='en';</script>```
#
# In a server environment (specifically node.js):
# ```global.__locale = 'en';```
# normalize in-app locale string to "en" or "de-AT"
parts = @__locale.split('-')
@ivoreis
ivoreis / paginated_collection.js
Created August 12, 2012 19:22 — forked from io41/paginated_collection.js
Pagination with Backbone.js
// includes bindings for fetching/fetched
var PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
typeof(options) != 'undefined' || (options = {});
this.page = 1;
typeof(this.perPage) != 'undefined' || (this.perPage = 10);
},
fetch: function(options) {
@ivoreis
ivoreis / gist:3333878
Created August 12, 2012 19:21 — forked from shripadk/gist:652819
Express authentication using Redis for session store and Couchdb for database (in coffeescript!)
###
Module dependencies
###
require.paths.unshift "#{__dirname}/lib/support/express-csrf/"
require.paths.unshift "#{__dirname}/lib/support/node_hash/lib/"
express = require 'express'
app = module.exports = express.createServer()
RedisStore = require 'connect-redis'