Skip to content

Instantly share code, notes, and snippets.

View jmdfm's full-sized avatar
💭
😺

John McDowall jmdfm

💭
😺
View GitHub Profile
@jmdfm
jmdfm / CORS Configuration
Created December 6, 2012 18:32 — forked from cyberwombat/CORS Configuration
JQuery file upload plugin (blueimp) with NodeJs Express3 directly to Amazon S3 with public access
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
@jmdfm
jmdfm / gemfile_best_practices
Created February 10, 2013 21:45
Gemfile Best Practices
source 'https://rubygems.org'
gem 'active_model_serializers', git: 'git://github.com/rails-api/active_model_serializers.git'
gem 'ember-rails', git: 'git://github.com/emberjs/ember-rails.git' # so we get the pre version
gem 'rack-mini-profiler', git: 'git://github.com/SamSaffron/MiniProfiler'
gem 'vestal_versions', git: 'git://github.com/zhangyuan/vestal_versions'
gem 'message_bus', path: 'vendor/gems/message_bus'
gem 'rails_multisite', path: 'vendor/gems/rails_multisite'
gem 'simple_handlebars_rails', path: 'vendor/gems/simple_handlebars_rails'
Request URL:http://192.168.10.200:3000/archives/1
Request Method:GET
Status Code:200 OK
Returns:
archive: {id:1, name:numbers, archive_item_count:60,…}
archive_items: [{id:1278, original_subject:Stack Overflow Careers -- Email Verification,…},…]
EVERYTHING A-OK! List of items displays perfectly in the View.
# A simple rake task to update Ember and Ember Data to latest official build from S3.
#
# Assumptions:
# - You're using the `ember-rails` gem
# - You are requiring rember with sprockets with something like `require ember`
#
# Usage:
#
# $ rake ember:update
#
class AppShare < ActiveRecord::Base
belongs_to :app
belongs_to :sharer, class_name: 'User'
belongs_to :sharee, class_name: 'User'
has_many :notifications, foreign_key: :notified_object_id, conditions: {notified_object_type: 'AppShare'}, dependent: :destroy
after_commit :create_notification, on: :create
def create_notification
@jmdfm
jmdfm / gist:5576579
Last active December 17, 2015 07:58
Hi John,
I thought you might be interested in this announcement: Jeffrey Zeldman,
a pioneer in online standards and usability on the Web, is partnering
with Quarterly Co. to engage with fans of his approach to the Web by
sending personally curated packages every three months.
Zeldman's influence online has steadily grown‹he now has more than
300,000 Twitter followers. As a Quarterly Co. contributor, Zeldman
is taking that influence offline to share digitally inspired ideas
VCR.configure do |c|
c.configure_rspec_metadata!
c.cassette_library_dir = 'spec/cassettes'
c.hook_into :webmock
end
We are looking for a Sr. Ruby Developer. Offices are in Gastown. We
have an ecommerce application that has taken off. We need you to be a
top Craftsman/woman.
You will contribute to the codebase. It's yours to mold.
The likely candidate needs at least 2+ years working on highly
scalable projects (ecommerce ideally) on the Ruby on Rails Framework.
You have at least five years commerical development. You have worked
on cloud based infrastructure and touched all the applicable areas
- Ember.Model
- Ember-Resource
- Ember Restless
- Emu
- Ember.js Persistence Foundation
# MODEL
class Case < ActiveRecord::Base
include Eventable
has_many :tasks
concerning :Assignment do
def assign_to(new_owner:, details:)
transaction do