Skip to content

Instantly share code, notes, and snippets.

@raytiley
raytiley / auth.js
Last active August 29, 2015 13:56
A controller using SimpleLogin from Firebase. Returns promises from login / logout to make working with Ember Routing simple.
var dbRef = new Firebase("https://YOUR-FIREBASE.firebaseio.com/");
export default Ember.Controller.extend({
/**
@property currentUser
@type {User}
@default null
*/
currentUser: null,
@joefiorini
joefiorini / structure.md
Last active August 29, 2015 13:57
eak-rails transition

Basically, it's a minimal Rails-API app (based loosely on this gist) embedded in an api folder in the root. Then the rest of it is a stock ember-cli setup. I don't know yet exactly how to make Rails look elsewhere for initializers, environments & locales, going to look into it.

api/              *.rb
  controllers/
  models/
  initializers/
  environments/
  locales/
  config.rb

routes.rb

function loadScript(module) {
var head = document.getElementsByTagName("head")[0];
var script = document.createElement("script");
return new RSVP.Promise(function(resolve, reject) {
script.language = "javascript";
script.src = module.url;
script.onload = function() {
resolve(module);
};
head.appendChild(script);
/* jshint node: true */
/**
* This is a hack-ish way of triggering Karma runs on broccoli builds.
*/
var path = require('path');
var spawn = require('child_process').spawn;
var broccoli = require('broccoli');
@krisselden
krisselden / index.hbs
Created April 25, 2014 06:01
sortable-list component example
{{#each fruits}}
{{this}}
{{/each}}
{{draggable-list values=fruits}}
class CsrfController < ApplicationController
def index
render json: { request_forgery_protection_token => form_authenticity_token }.to_json
end
end
@knomedia
knomedia / ember_cli_rails.rake
Last active August 29, 2015 14:00
ember_cli_rails initial thoughts (see: https://github.com/knomedia/ember-cli-rails for a more complete solution)
require 'nokogiri'
namespace :ember_cli_rails do
desc "compile ember and update application.html.erb with ENV vars"
task :build => [:ember, :update_env] do
end
desc 'Build ember app and copies css and js files to rails'
@lordhumunguz
lordhumunguz / Sample_Gruntfile.coffee
Last active August 29, 2015 14:02
A sample grunt file for {blog url}
module.exports = (grunt) ->
timestamp = Date.now().toString()
grunt.initConfig
env: grunt.file.readJSON '.env.json'
s3:
options:
key: '<%= env.AWS.AccessKeyId %>'
secret: '<%= env.AWS.SecretKey %>'
class RedisController < ApplicationController
private
def render_from_redis(prefix, variation = nil)
manifest_id = params[:manifest_id]
if manifest_id.blank?
current_manifest_key = if variation
"#{prefix}:#{variation}:current"
else
"#{prefix}:current"