Skip to content

Instantly share code, notes, and snippets.

@superlou
superlou / lodging.js
Created January 12, 2015 01:48
Access to dev.api.ean.com
import Ember from 'ember';
export default Ember.Controller.extend({
customerSessionId: 23, // todo Should be unique for each user session
possible: function(location) {
$.get('http://dev.api.ean.com/ean-services/rs/hotel/v3/list', {
apiKey: 'mc7re8wzh2vnnw67uz4je6qq',
cid: 55505,
_type: 'json',
@superlou
superlou / Controller new-character.js
Created November 10, 2014 01:38
Duplicate records
import Ember from 'ember';
export default Ember.ObjectController.extend({
actions: {
save: function() {
var _this = this;
var record = this.store.createRecord('character', this.get('model'));
record.save();
@superlou
superlou / Brocfile.js
Last active August 29, 2015 14:07
CKEditor file picking
/* global require, module */
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var pickFiles = require('broccoli-static-compiler');
var app = new EmberApp();
// Use `app.import` to add additional libraries to the generated
// output files.
//
@superlou
superlou / used-service-box.hbs
Created September 1, 2014 17:25
Weird corner case
<div class="panel">
<div class='panel-summary' {{action 'toggleExpanded'}}>
<div class='row'>
<div class='span-10'>
{{usedService.service.name}}
<div class='subtle'>
{{usedService.service.desc}}
| <a href='#' {{bind-attr href="service.siteLink"}}>Visit</a>
</div>
</div>
@superlou
superlou / service-selector.hbs
Created August 24, 2014 01:20
Uncooperative {{#if}}
<div class='service-selector'>
{{input value=service focus-out="lostFocus"}}
{{#if showMatches}}
<ul class='matches'>
{{#each matchedServices}}
<li>{{name}}</li>
{{/each}}
</ul>
{{/if}}
</div>
@superlou
superlou / intervideosrc.c
Created August 6, 2014 01:08
Trying to write intervideosrc/sink test
/* GStreamer
*
* unit test for intervideosrc
*
* Copyright (C) <2014> Louis Simons <lousimons at gmail dot com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
@superlou
superlou / cost_rollup.py
Created July 21, 2014 00:58
Generate a summary of all parts and their costs given a prices.csv file and mfpns assigned on components
import numpy as np
import pandas
import xml.etree.ElementTree as ET
def get_component_field(comp_el, field_name, default=None):
field_el = comp_el.find("./fields/field[@name='{0}']".format(field_name))
if field_el is not None:
return field_el.text
else:
@superlou
superlou / Makefile.am
Created June 30, 2014 00:36
Intervideosrc test
include $(top_srcdir)/common/check.mak
CHECK_REGISTRY = $(top_builddir)/tests/check/test-registry.reg
TEST_FILES_DIRECTORY = $(top_srcdir)/tests/files
GST_TOOLS_DIR = $(top_builddir)/tools
REGISTRY_ENVIRONMENT = \
GST_REGISTRY_1_0=$(CHECK_REGISTRY)
@superlou
superlou / intervideotest2.c
Last active August 29, 2015 14:02
intervideosrc swapping channels test
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst.h>
#include <stdlib.h>
#include <glib/gprintf.h> // Needed because of bug in glib includes?
#include <string.h>
@superlou
superlou / checkout.es6
Created April 29, 2014 23:56
Computed properties for ember data
var attr = DS.attr;
var belongsTo = DS.belongsTo;
App.Checkout = DS.Model.extend({
book: belongsTo('book'),
patron: belongsTo('patron'),
status: attr(),
closed_at: attr('date'),
created_at: attr('date'),