Skip to content

Instantly share code, notes, and snippets.

View CodeOfficer's full-sized avatar

Russell Jones CodeOfficer

View GitHub Profile
@wycats
wycats / ideas.md
Last active December 10, 2015 19:08

Router

// blogs.handlebars (and blogs/index.handlebars)
match("/blogs").to("blogs", function(match) {
  // blogs/starred.handlebars
  match("/starred").to("starred");
  // blog.handlebars (and blog/index.handlebars)
  match("/:blog_id").to("blog", function(match) {
    // posts.handlebars (and posts/index.handlebars)
@tomdale
tomdale / gist:4004913
Created November 2, 2012 23:10
Per-Type Adapters Proposal

Per-Type Adapter Hooks

Requirements

Many existing JSON APIs are not consistent between types. As JSON endpoints grew organically and were built by different engineers at different times, the style in which records are represented can vary wildly.

Historically, we have asked adapter authors to rely on the fact that the type of record is provided to all adapter hooks (either by passing a type argument, or by passing a record

@scottburton11
scottburton11 / gist:3222152
Created August 1, 2012 00:58
Audio Compression for Voiceover

About compression

Audio compression is used to reduce the dynamic range of a recording. Dynamic range is the difference between the loudest and softest parts of an audio signal. It was originally used to guard against defects when cutting wax and vinyl phonograph records, but generally became useful as a way of increasing the loudness of an audio recording without achieving distortion.

The goal of most compression applications is to increase the amplitude of the softest parts of a recording, without increasing the amplitude of the loudest parts.

Compressor anatomy

Compressors generally all have the same conceptual parts. However, not all compressors present variable controls for all parts to the user. If you don't see all of your compressor's controls here, there's a chance it either has a fixed value (and no control), or is named something else:

@trek
trek / unit.js
Created July 22, 2012 02:40
Run your mocha unit tests suite via casper.js
// get a Casper object.
// See http://casperjs.org/
var casper = require('casper').create();
// this will be evaluated inside the context of the window.
// See http://casperjs.org/api.html#casper.evaluate for notes on
// the difference between casper's running environment and the
// DOM environment of the loaded page.
function testReporter(){
// casper is webkit, so we have good DOM methods. You're
@n1k0
n1k0 / kw-positions.js
Created July 15, 2012 08:50
CasperJS script to retrieve keyword occurence positions within a given page
var casper = require('casper').create();
var positions = [];
var kw = 'JSON';
casper.start('http://phantomjs.org/', function() {
var pageHeight = this.evaluate(function() {
return document.body.scrollHeight;
});
if (pageHeight < 1) {
this.echo('no page height', 'ERROR').exit();

Routing in Ember

In Ember, the application's state manager handles routing. Let's take a look at a simple example:

App.stateManager = Ember.StateManager.create({
  start: Ember.State.extend({
    index: Ember.State.extend({
      route: "/",
@wm
wm / pair.md
Last active April 1, 2021 23:37
TMUX Pairing

SSH setup for remote pairing

If Animal and Fozzie wanted to pair on Animals machine and they both have access to shared.muppets.com then they could use the following setup

  • Animal will have the following in ~/.ssh/config
Host tunnel_from_muppets
  Hostname shared.muppets.com
 RemoteForward 1235 localhost:22
class User < ActiveRecord::Base
attr_accessible :name
has_many :admin_memberships, class_name: "Membership", conditions: {role: 'admin'}
has_many :editor_memberships, class_name: "Membership", conditions: {role: 'editor'}
def admin?
admin_memberships.exists?
end
@ppcano
ppcano / assetfile.rb
Created March 13, 2012 17:38
assetfile
input "app" do
match "app/lib/**/*.js" do
minispade :rewrite_requires => true, :string=> false, :module_id_generator => proc { |input|
id = input.path.dup
id.sub!('/lib/', '/')
id.sub!(/\.js$/, '')
id.sub!(/\/main$/, '')
#id.sub!('/tests', '/~tests')
{"api_response":{"tags":"","groupPointAward":"0","fullUrl":"http://newsit.net/assets/badges/multitasker.png","dateIssued":"1327945543","pointAward":"0","serviceType":"1","endTime":"0","rules":{"Rule":{"actionTag":"Video_Watch","achieved":"0","sortOrder":"1","serviceActionType":"none","type":"count","serviceType":"nitro","operator":"GE","goal":"1","completed":"false"}},"ruleMatchType":"0","startTime":"1327945543","completionCount":"0","hideUntilEarned":"0","name":"Be a Multitasker Workaround Test","repeatable":"0","folderName":"Participation","groupFlag":"0","applyMultiplier":"0","pointCategory":"Points","dailyAchievementLimit":"0"}}