console.log 'hello'print 'world!'| # user.json.rabl_spec.rb | |
| APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', '..')) | |
| $: << File.join(APP_ROOT, 'spec/support') # for my spec helpers | |
| $: << File.join(APP_ROOT, 'config/initializers') # for rabl_init.rb | |
| require 'my_spec_mocks' | |
| require 'rabl' | |
| require 'rabl_init' | |
| # We need to fool rabl into thinking we are running rails. | |
| # All rabl wants is the root path to help in finding templates. |
| /** | |
| * Based conceptually on the _.extend() function in underscore.js ( see http://documentcloud.github.com/underscore/#extend for more details ) | |
| * Copyright (C) 2012 Kurt Milam - http://xioup.com | Source: https://gist.github.com/1868955 | |
| * | |
| * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | |
| * | |
| * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |
| * | |
| * You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/. | |
| **/ |
| rivets.configure({ | |
| adapter: { | |
| subscribe: function(obj, keypath, callback) { | |
| if (obj instanceof Backbone.Collection) { | |
| obj.on('add remove reset', function () { | |
| callback(obj[keypath]) | |
| }); | |
| } else { | |
| obj.on('change:' + keypath, function (m, v) { callback(v) }); | |
| }; |
| # If you have ruby installed, you can use this file to run a basic web server | |
| # and avoid silly cross-site forgery issues when doing your assignments. | |
| # | |
| # * Install ruby, if you haven't already | |
| # Macs come with ruby, so just open up a terminal and type: ruby -v | |
| # and press Return (or Enter or whatever). If you get a response, | |
| # you have ruby already! Move to the next step. If not, consult Google. | |
| # | |
| # Windows users can easily install ruby, just check out http://rubyinstaller.org/ | |
| # When you're done installing, open up a command prompt (or powershell) and |
| <!ELEMENT note (to,from,heading,body)> | |
| <!ELEMENT to (#PCDATA)> | |
| <!ELEMENT from (#PCDATA)> | |
| <!ELEMENT heading (#PCDATA)> | |
| <!ELEMENT body (#PCDATA)> |
| [ | |
| { | |
| "class": "label_control", | |
| "color": [255, 255, 255], | |
| "shadow_color": [24, 24, 24], | |
| "shadow_offset": [0, -1] | |
| }, | |
| { | |
| "class": "button_control", | |
| "content_margin": [6, 5, 6, 6], |
| #!/usr/bin/env ruby | |
| # Usage: | |
| # | |
| # ./mon git 0.3 # => will monitor "git" every 0.3 seconds until it dies | |
| start = Time.now | |
| user = `whoami`.strip | |
| name = ARGV[0] | |
| frequency = (ARGV[1] || 1).to_f # Default to 1 second if second argument not given |
| #! /usr/bin/ruby | |
| # This file is intended to be used for a specific trello project, but the principle | |
| # displayed here of extracting data from a trello json export file can be used in | |
| # a wide variety of ways. Edit this file to your heart's content! | |
| # | |
| # Put this file in the same folder as "lindy-hop-thesaurus.json" (or whatever your | |
| # Trello export file is called... and run it from the command line like this: | |
| # | |
| # ruby print_json.rb lindy-hop-thesaurus.json |
| ### | |
| source: http://blog.gaslight.co/page/3 | |
| Debounce a function so it only executes once, after all inputs to it have ended, or after | |
| a specified timeout interval. Optionally pass another argument to your debounced function | |
| to execute it immediately, for example: `myDebouncedFunction( some, arguments, { now: true } )` | |
| @example An Ember.js controller example usage | |
| App.DocumentController = Ember.ObjectController.extend |