Install the following requirements:
brew info zeromq
npm install zmq
npm install socket.io
gem install ffi-rzmq
Within the app directory run the following commands in different panes.
ruby worker.rb
| ------------ From Rake Task | |
| namespace :app do | |
| # Checks and ensures task is not run in production. | |
| task :ensure_development_environment => :environment do | |
| if Rails.env.production? | |
| raise "\nI'm sorry, I can't do that.\n(You're asking me to drop your production database.)" | |
| end | |
| end |
| import sublime, sublime_plugin | |
| import os | |
| class DetectFileTypeCommand(sublime_plugin.EventListener): | |
| """ Detects current file type if the file's extension isn't conclusive """ | |
| """ Modified for Ruby on Rails and Sublime Text 2 """ | |
| """ Original pastie here: http://pastie.org/private/kz8gtts0cjcvkec0d4quqa """ | |
| def on_load(self, view): | |
| filename = view.file_name() |
| # config/initializers/buffered_logger.rb | |
| module ActiveSupport | |
| # Format the buffered logger with timestamp/severity info. | |
| class BufferedLogger | |
| NUMBER_TO_NAME_MAP = {0=>'DEBUG', 1=>'INFO', 2=>'WARN', 3=>'ERROR', 4=>'FATAL', 5=>'UNKNOWN'} | |
| NUMBER_TO_COLOR_MAP = {0=>'0;37', 1=>'32', 2=>'33', 3=>'31', 4=>'31', 5=>'37'} | |
| # http://api.rubyonrails.org/classes/Time.html#method-i-2D | |
| DATE_FORMATTER = {0 => :db, 1 => :short, 2 => :long, 3 => :time} |
| <div data-replace="item"> | |
| PARTIAL 1: <span data-bind="item.name"></span> | |
| </div> |
| # controllers/dummy_controller.coffee | |
| MyApp.flashSuccess "Record updated successfully!" |
| # controllers/dummy_controller.coffee | |
| Classifieds.set "flash.success", "Record #{@get('record.title')} updated successfully!" |
| var HotelDescription = (function ($) { | |
| "use strict"; | |
| var HotelDescription = function ($element) { | |
| this.$long = $('.long-description', $element); | |
| this.$short = $('.short-description', $element); | |
| this.$more = $('.read-more', $element); | |
| this.$less = $('.read-less', $element); | |
| this.bind(); |
Install the following requirements:
brew info zeromq
npm install zmq
npm install socket.io
gem install ffi-rzmq
Within the app directory run the following commands in different panes.
ruby worker.rb
| // Generated on 2013-09-27 using generator-angular 0.4.0 | |
| 'use strict'; | |
| var path = require('path'); | |
| // # Globbing | |
| // for performance reasons we're only matching one level down: | |
| // 'test/spec/{,*/}*.js' | |
| // use this if you want to recursively match all subfolders: | |
| // 'test/spec/**/*.js' |
| 'use strict'; | |
| var express = require('express'), | |
| app = express(), | |
| http = require('http'), | |
| server = http.createServer(app), | |
| path = require('path'), | |
| io = require('socket.io').listen(server), | |
| fs = require('fs'), | |
| zmq = require('zmq'), |