Julio Cesar Ody juliocesar

View fails.coffee
1 2 3 4 5 6 7 8 9 10
describe "Asynchronous specs", ->
funcRunInBackground = ->
value = 1
 
wrapFuncRunInBackground = (done) ->
# setup for simmulating the async operation, a function run in the background
setTimeout ->
funcRunInBackground()
done()
, 3000
View breakpoint.sass
1 2 3 4 5 6 7 8 9 10
// Screen size breakpoints
// =======================
//
// Example usage:
//
// .page-header
// +breakpoint(desktop)
// width: 50%
// +breakpoint(tablet)
// width: 80%
View prefix-mixins.sass
1 2 3 4 5 6 7 8 9 10
// Prefix mixins
// =============
//
// A set of SASS mixins for abstracting vendor prefixes.
 
@mixin background-size($parameters)
-webkit-background-size : $parameters
-moz-background-size : $parameters
-o-background-size : $parameters
background-size : $parameters
View Capfile
1 2 3 4 5 6 7 8 9 10
# Capistrano deployment file
# ==========================
#
# Deployment requires that you can log in as "web", which means you'll
# need it's password.
 
require 'bundler/capistrano'
 
set :rvm_ruby_string, :local # Use the same ruby as used locally for deployment
set :rvm_autolibs_flag, "read-only" # More info: rvm help autolibs
View gist:6409580
1 2 3 4 5 6 7 8 9 10
# Kool console
# ============
#
# A snippet for running CoffeeScript snippets in browser, with a cool
# centered text input.
#
# Press <meta> + K to open the console.
 
# Styles for the text field.
CSS = """
View gist:6075975
1 2 3 4 5 6 7 8 9 10
# Multiple models/collections event tracking
# ==========================================
#
# This is handy, for instance, when something needs to happen once a set
# of collections fire `sync`. For example:
#
# Backbone.Events.when [User, Projects], 'sync', ->
# alert 'carry on with all the data ready'
 
Backbone.Events.when = (models, track, callback) ->
View gist:5997750
1 2 3 4 5 6 7 8 9
# Enables caching in Sprockets
# ============================
#
# I couldn't find it documented anywhere until I searched for it. Sprockets will recompile
# every file in a manifest for every request it serves if even *one* file in it changes,
# which it really slow for developing anything.
#
# This fixes that by ensuring only files that get changed get recompiled. NOTE: This is
# just an example. What you're looking for is in line 14.
View gist:5993429
1 2 3 4 5 6 7 8 9 10
# Application router
# ==================
#
# Written for https://medium.com/what-i-learned-building/89e504dd8313.
# This is how it'd look like without the pattern applied.
 
class Router extends Backbone.Router
 
routes:
'users/:id/posts' : ->
View gist:5790235

AR association with special attributes

Is there a straightforward way to have an intermediate model in AR (has many through type of scenario) which adds attributes to the association?

E.g.: has_many :fruits, :through => :qualified_fruits, :class_name => 'Fruit'.

Fruit objects returned have a "quality" attribute which actually lives in :qualified_fruits.

View modules.js
1 2 3 4 5 6 7 8 9 10
// ES6 modules
// =============
 
// Compartments of code in ES6. Declared as strings with a keyword.
 
module 'fruit' {
export var list = ['Apple', 'Banana', 'Grape'];
 
export var makeSmoothie = function() {
// ...
Something went wrong with that request. Please try again.