Skip to content

Instantly share code, notes, and snippets.

View westonplatter's full-sized avatar

Weston Platter westonplatter

View GitHub Profile
@westonplatter
westonplatter / json.json
Created December 23, 2013 02:16
What's the fastest way to get all the ids into a single Javascript array?
{
"id": "0",
"item": [
{
"id": "1161736030",
"open": "1",
"text": "12\/14\/2013",
"item": [
{
"id": "1163797134",
This,
<script type="text/javascript">ga('create', 'UA-12345678-9', {cookieDomain: 'none', legacyCookieDomain: 'none'});ga('send', 'pageview', {'page': '/checkout/carts/show'});</script>
conflicts with Support Doc instructions,
http://docs.shopify.com/support/other/general-information/google-analytics-goals-and-funnels#important-note
// meteor file streaming with iron-router
Router.map(function () {
this.route('home', {
path: '/',
template: 'home',
action: function(){
console.log("home router fired");
}
});
x = 1
foo = ->
x = 2
return
foo()
@westonplatter
westonplatter / HomeController.js
Created November 20, 2013 07:16
stream MP3 through SailsJS framework
/**
* HomeController
*
* @module :: Controller
* @description :: Contains logic for handling requests.
*/
module.exports = {
index: function (req,res) {
@westonplatter
westonplatter / server.js
Last active December 28, 2015 19:59
stream MP3 with 19 lines of nodejs
// adjusted from dtrce's example, https://gist.github.com/dtrce/1204243
var http = require('http'),
fileSystem = require('fs'),
path = require('path');
http.createServer(function(request, response) {
var filePath = 'Users/weston/visible/test.mp3';
var stat = fileSystem.statSync(filePath);
curl -I https://learn.thoughtbot.com/orenstein/articles
// fully finished tests
// ressources/ ... /completed
//
describe("I can create a Javascript variable", function(){
it("as a number", function(){
var one = 1;
expect(one).toBe(1);
});
it("as a string", function(){
var abc = "xyz";
<script id="template-upload" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
<tr class="template-upload fade">
<td class="preview"><span class="fade"></span></td>
<td class="name"><span>{%=file.name%}</span></td>
<td><label>Caption: <input name="asset[caption]" required></label></td>
<td><label>Start: <input name="asset[start]" required></label></td>
<td><label>Stop: <input name="asset[stop]" required></label></td>
module Spree
class OrdersController < Spree::StoreController
# this gets included by the Spree::BaseController which the Spree::StoreController inherits from
include Spree::Core::ControllerHelpers::StrongParameters
# ... a bunch of controller methods ...
private