Skip to content

Instantly share code, notes, and snippets.

View joelmoss's full-sized avatar

Joel Moss joelmoss

View GitHub Profile
@joelmoss
joelmoss / gist:5743190
Last active December 18, 2015 06:59
Codio JS Class proposal

Codio Javascript Class Proposal

While the Codio Client has a simple inheritance system in the form of the core/context plugin, it leaves a little to be desired and is lacking in a few areas that I feel would greatly improve the readability of our code base, as well as providing a little extra functionality.

Javascript has no such thing as Classes, but it has several different ways to fake them. We need a clean and concise way to define and use classes, with the ability for constructors, inheritance and access to overridden methods.

John Resig posted an article a long time ago with his solution for Classes in Javascript. It's simple, but powerful, and is extremely readable, so it will form the basis of this proposal.

The Base Class

@joelmoss
joelmoss / gist:5714409
Created June 5, 2013 14:48
The perfect task/issue/bug manager?
  • Quick and easy issue creation
@joelmoss
joelmoss / 0-readme.md
Created July 26, 2012 12:23 — forked from sj26/0-readme.md
ruby-1.9.3-p194 cumulative performance patch.

Patched ruby 1.9.3-p194 for 30% faster rails boot

What is?

This script installs a patched version of ruby 1.9.3-p194 with patches for boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84). It also includes the new backported GC from ruby-trunk.

Huge thanks to funny-falcon for the performance patches.

@joelmoss
joelmoss / gist:2651918
Created May 10, 2012 08:40
Short setup script for rails projects
#!/bin/sh
set -e
export PATH="$(dirname "$0")/../bin:$PATH" # Use binstubs
if [ "$1" = "-v" ]; then
exec 3>&1
else
exec 3>/dev/null
fi
@joelmoss
joelmoss / gist:2629474
Created May 7, 2012 18:26
UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame UIScreen.mainScreen.bounds
@window.rootViewController = ContactsController.alloc.init
@window.makeKeyAndVisible
true
end
@joelmoss
joelmoss / gist:2470666
Created April 23, 2012 12:37
Capistrano recipe for Puma start/stop/restarts
set :shared_children, shared_children << 'tmp/sockets'
namespace :deploy do
desc "Start the application"
task :start, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && RAILS_ENV=#{stage} bundle exec puma -b 'unix://#{shared_path}/sockets/puma.sock' -S #{shared_path}/sockets/puma.state --control 'unix://#{shared_path}/sockets/pumactl.sock' >> #{shared_path}/log/puma-#{stage}.log 2>&1 &", :pty => false
end
desc "Stop the application"
task :stop, :roles => :app, :except => { :no_release => true } do
@joelmoss
joelmoss / gist:1839263
Created February 15, 2012 21:56 — forked from mperham/gist:1831203
Campfire deploy announcements
# Put this at the bottom of your config/deploy.rb
# Requires config file at .campfire.yml or ~/.campfire.yml or ../.campfire.yml
# with your API token from your Campfire "My Info" page:
#
# token: lkjsadfsaduoi1u31oui3eh1kj2h
# roomid: 123456
# subdomain: acmeco
class Room
attr_accessor :config
jmoss@deals-dev:/var/lib/jenkins/jobs/deals/workspace$ bundle exec rake spec --trace
** Invoke spec (first_time)
** Execute spec
/usr/local/rvm/rubies/ruby-1.9.3-p0/bin/ruby -S rspec ./spec/lib/deals/tagging/associations/has_many_geotags_spec.rb ./spec/lib/deals/tagging/associations/builder/tag_collection_spec.rb ./spec/lib/deals/tagging/associations/has_many_tags_spec.rb ./spec/lib/deals/tagging/reflection_spec.rb ./spec/models/campaign/publisher_rules_spec.rb ./spec/models/campaign/associations_spec.rb ./spec/models/campaign/validations_spec.rb ./spec/models/campaign/callbacks_spec.rb ./spec/models/campaign/attributes_spec.rb ./spec/models/campaign/actions_spec.rb ./spec/models/employee_spec.rb ./spec/models/publisher_spec.rb ./spec/models/tag_spec.rb ./spec/models/feed_spec.rb ./spec/models/person_spec.rb ./spec/models/deal_address_spec.rb ./spec/models/partner_spec.rb ./spec/models/deal/scopes_spec.rb ./spec/models/deal/associations_spec.rb ./spec/models/deal/logos_spec.rb ./spec/models/deal/validations_s
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
# - a browser with WebSocket support
#
# Usage:
# ruby redis_pubsub_demo.rb
#
STDOUT.sync = true
require 'queue'
start_time = Time.now.to_i
msg = 0
queue = Queue.new("testing")
queue.subscribe do |obj|
msg += 1