Skip to content

Instantly share code, notes, and snippets.

{
"quizzes": [
{
"access_code": null,
"all_dates": [
{
"base": true,
"due_at": null,
"lock_at": null,
"unlock_at": null
  • Pending specs
  • Promise support
  • lol too tired
@fivetanley
fivetanley / pretender_route.js
Created June 5, 2014 19:34
a javascript file generated by my ruby thang
(function(){
'use strict';
var data = '
{
"hello": "goodbye"
}
This file has been truncated, but you can view the full file.
/*!
* @overview Ember - JavaScript Application Framework
* @copyright Copyright 2011-2014 Tilde Inc. and contributors
* Portions Copyright 2006-2011 Strobe Inc.
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
* @license Licensed under MIT license
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
* @version 1.8.0-beta.1+canary.3edd7bde
*/
// More about initializers here http://emberjs.com/api/classes/Ember.Application.html#toc_initializers
window.initializeWidget = function(opts){
var query = opts.initialQuery;
Ember.Application.initializer({
name: 'setSearchQuery',
initialize: function(container, application){
container.lookup('controller:search').set('query', query);
}
})
@fivetanley
fivetanley / convert_for_ember_cli.rb
Last active August 29, 2015 14:05
Move files over for Ember CLI with this one weird trick.
# Script to rename underscored files to dasherized
# Example: changes app/models/foo_thing.js to app/models/foo-thing.js
# Ember CLI decided dashes for consistency, so let's change it over
# to that!
# First, install active support with gem install activesupport
# Run with "ruby convert_for_ember_cli.rb"
require 'fileutils'
require 'active_support/core_ext/string'
# Replace app,test with your filenames.
import Ember from 'ember';
var denodeify = Ember.RSVP.denodeify;
class DropboxService {
constructor(apiKey){
this.apiKey = apiKey;
this.client = new Dropbox.Client({key: this.apiKey});
}
<% if (foo) { %> <!-- need opening bracket here -->
<% } %> <!-- having this bracket here looks weird and has been annoying to write imo ->
var watcher = options.watcher;
var started = false;
var builder = watcher.builder;
var oldBuild = builder.build;
builder.build = function(){
return this.pausePromise.then(function(){
return oldBuild.apply(this);
}.bind(this));
};
App.Router.map(function(){
// simple route
this.route('taco');
// simple resource
this.resource('sauce');
// "namespaced" resource with implicit "index" route
this.resource('sauces.taco');