Skip to content

Instantly share code, notes, and snippets.

View mrinterweb's full-sized avatar

Sean McCleary mrinterweb

View GitHub Profile
@mrinterweb
mrinterweb / flippin_file
Created July 21, 2008 21:41
Flippin File
This is a flipping file
Barg!
This is a frikin RAD tool
require 'spec_helper'
describe "root path", js: true do
before do
visit '/'
end
it "should have some content on the page" do
expect(page).to have_content 'Welcome to a special site'
end
@mrinterweb
mrinterweb / router_spec.coffee
Created February 18, 2014 18:56
Teaspoon test helpers using require.js and CoffeeScript
module 'routing specs',
setup: ->
teardown: ->
App.reset()
require ['testingHelper'], (testingHelper)->
test 'root route', ->
testingHelper.routesTo('/', 'index')
@mrinterweb
mrinterweb / keybase.md
Created April 9, 2014 23:54
keybase.md

Keybase proof

I hereby claim:

  • I am mrinterweb on github.
  • I am mrinterweb (https://keybase.io/mrinterweb) on keybase.
  • I have a public key whose fingerprint is B61F E9FA FF8E 7B3F 1635 98AE DF00 B371 6395 D7EB

To claim this, I am signing this object:

@mrinterweb
mrinterweb / gist:5d7478db469bfeeb9984
Created May 15, 2014 00:00
Showing server-side errors in handlebars
<ul>
{{#each model.errors.content}}
<li>{{attribute}} {{message}}</li>
{{/each}}
</ul>
@mrinterweb
mrinterweb / speak.rb
Last active August 29, 2015 14:03
Fun with OS X "say" and linux espeak commands
#! /usr/bin/env ruby
# Some of the words are misspelled to help the say program pronounce them right
#
# copy the following line and paste for fun!
# curl -O https://gist.githubusercontent.com/mrinterweb/0ed2ac30a97e25e03fad/raw/5da7c2a012a08cfcc9649e0f410d53f8986e4990/speak.rb && mv speak.rb speak && chmod a+x speak && ./speak
greetings = [
'ahoy',
'greeting',
'saalutations',
@mrinterweb
mrinterweb / groups.js.coffee
Created July 21, 2014 22:03
Ember Data Serialize Attributes Example
# This is a demonstration of how to have the attribute friend_ids serialized
# when posted to the server
# Add friends like this in the controller:
# group = @get('model')
# friend = @store.getById('friend', friend.get('id'))
# group.get('friends').addObject(friend)
# group.save()
App.Group = DS.Model.extend
friends: DS.hasMany 'friend', async: true
App.ApplicationAdapter = DS.ActiveModelAdapter.extend
namespace: 'api/v1'
host: App.BaseUrl
setHeaders: (->
console.log "setting headers", @get('currentSession.token')
@set('headers',
token: @get('currentSession.token')
Accept: 'application/json'
)
).observes('currentSession.token').on('init')
App.FriendCache = Em.Object.extend
init: ->
@store = App.__container__.lookup('store:main')
findAll: ->
localforage.getItem('friends').then (cfriends)=>
if Em.isEmpty(cfriends)
@findAndCache()
else
allFriends = @store.all('friend')
@mrinterweb
mrinterweb / gist:7e23a153a47c25adba1d
Created September 16, 2014 23:44
Ember-data localforage record cache
App.Cache = Em.Object.extend
init: ->
@store = App.__container__.lookup('store:main')
# tries to load the results from localforage cache or from normal adapter
findAll: ->
localforage.getItem(@modelStr).then (cacheItems)=>
if Em.isEmpty(cacheItems)
@findAndCache()
else