Skip to content

Instantly share code, notes, and snippets.

View scott-w's full-sized avatar

Scott Walton scott-w

  • Hotjar
  • Newcastle upon Tyne
View GitHub Profile
@scott-w
scott-w / .babelrc
Created October 20, 2017 21:13
The Babel RC file
{
"presets": ["env"]
}
@scott-w
scott-w / model.test.js
Created October 14, 2017 14:34
New Failing Tests
import { assert } from 'chai';
import { MyModel } from 'model';
describe('MyModel', function() {
let model = null
afterEach(function() {
model = null;
});
@scott-w
scott-w / model.test.js
Last active October 10, 2017 20:49
Test our Model
import { assert } from 'chai';
import { MyModel } from 'model';
describe('MyModel', function() {
let model = null
afterEach(function() {
model = null;
});
@scott-w
scott-w / model.js
Created October 10, 2017 20:38
Custom Model Implementation
import { Model } from 'backbone';
export const MyModel = Model.extend({
defaults: {
counter: 0
},
/**
* Increment our counter and return the new value.
* @returns {number} The incremented counter
@scott-w
scott-w / webpack.config.js
Created October 7, 2017 07:42
Webpack configuration
const webpack = require("webpack");
const path = require("path");
module.exports = {
entry: {
app: ["./app/index.js"]
},
module: {
loaders: [
{
@scott-w
scott-w / package.json
Last active October 7, 2017 07:40
The devDependencies part of your package.json file
"devDependencies: {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.0",
"babel-preset-es2015": "^6.24.1",
"babel-register": "^6.26.0",
"chai": "^4.1.1",
"karma": "^1.7.0",
"karma-babel-preprocessor": "^6.0.1",
@scott-w
scott-w / mocha.opts
Created October 7, 2017 07:36
Mocha Options
-r babel-polyfill
--full-trace
--compilers js:babel-register
@scott-w
scott-w / karma.conf.js
Created October 2, 2017 20:50
Karma Config for MarionetteJS
// Karma configuration
// Generated on Sat Aug 26 2017 16:02:46 GMT+0100 (BST)
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: "",
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
@scott-w
scott-w / index.js
Last active August 19, 2017 16:25
Backend Poller
import { Application } from "backbone.marionette";
import { IndexView } from "./view";
import { UpdateModel } from "./model";
const App = Application.extend({
channelName: "global",
region: "#app-root",
@scott-w
scott-w / index.html
Created August 19, 2017 15:59
App Index
{% load app_loader_tags %}<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://cdn.myproductiondomain.com/public/css/style.css" rel="stylesheet">
</head>
<body>