Skip to content

Instantly share code, notes, and snippets.

@superlou
superlou / Error Message
Last active August 29, 2015 14:00
undefined method `checkout_url' on line 21. Works if I change checkouts_controller.rb line 21 to `respond_with checkout, location: api_v1_checkout_path(checkout)`.
<header>
<h1>
NoMethodError
in Api::V1::CheckoutsController#create
</h1>
</header>
<div id="container">
<h2>undefined method `checkout_url&#39; for #&lt;Api::V1::CheckoutsController:0x00000005ec52c0&gt;</h2>
@superlou
superlou / edit.es6
Last active August 29, 2015 14:00
Library Update
export default Ember.ObjectController.extend({
actions: {
save: function() {
var _this = this;
console.log(this.get('content'));
this.get('content').save().then(
function(val) {
_this.transitionToRoute('books.book', _this.get('content'));
},
function(err) {}
@superlou
superlou / Sparse Data
Created April 22, 2014 13:41
Example Data
timestamp1, data1, timestamp2, data2
1, 324, 1.2, 102
2, 231, 2.3, 429
3, 432, 3.1, 300
@superlou
superlou / game_server.rb
Created March 15, 2014 13:03
Game Logic
require 'artemis'
require './components.rb'
class GameServer
def run
puts "Starting server..."
@world = Artemis::World.new
@world.add_manager Artemis::TagManager.new
@world.set_system(RouteMovementSystem.new).setup
import os
import gi
try:
gi.require_version('Gst', '1.0')
except ValueError:
print 'Could not find required Gstreamer library'
sys.exit(1)
from gi.repository import GObject, Gst
os.environ["GST_DEBUG"] = "4"
@superlou
superlou / DatingTextField.js
Last active January 3, 2016 18:09
Property not updating on set. When the text field gets something good (e.g. "today"), the console prints "I set it!", but I never see isMatched get called.
OurMemories.DatingTextField = Ember.TextField.extend({
parsedDate: "",
input: function(evt) {
this.get('parentView').send('inputChanged', this.get('value'));
var parsedDate = Date.create(this.get('value'));
if (parsedDate != "Invalid Date") {
this.set('parsedDate', parsedDate);
console.log('I set it!');
@superlou
superlou / image.hbs
Created January 16, 2014 23:02
Binding data to components
<div class="small-3 columns">
{{when-input text=when}}
</div>
@superlou
superlou / images_controller.rb
Created January 5, 2014 02:18
undefined method `image_url' for #<ImagesController:0x000000025ff6c0> on line 10 Solved: needed "resources images" in routes.
class ImagesController < ApplicationController
respond_to :json
def create
@image = Image.new
@image.user_id = params[:user_id]
@image.upload = params[:upload]
@image.save!
puts @image.upload.url
@superlou
superlou / store.js
Created January 4, 2014 16:52
from Ember-Rails
App.Store = DS.Store.extend({
// Override the default adapter with the `DS.ActiveModelAdapter` which
// is built to work nicely with the ActiveModel::Serializers gem.
adapter: '_ams'
});
@superlou
superlou / front-lmctv.php
Created December 23, 2013 15:46
Wordpress frontpage bottlneck
<?php
/*
Template Name: Front for LMCTV
*/
global $meta;
$meta = get_post_custom(); // Custom fields
?>
<?php //get_header(); ?>