Skip to content

Instantly share code, notes, and snippets.

View mbritton's full-sized avatar
🏠
Working from home

Mike Britton mbritton

🏠
Working from home
View GitHub Profile
@mbritton
mbritton / backbone_jqm_sketch.js
Created June 22, 2012 13:55
Backbone / jQM sketch
var productCollection = {};
var eventMediator = {};
var viewUtils = new utils();
window.products = new Products();
window.product;
window.CartView = Backbone.View.extend({
template : _.template(viewUtils.getTemplate('Cart')),
render : function(eventName) {
@mbritton
mbritton / index.html
Created March 27, 2013 14:31
YUI Routing.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>YUI App Framework Test Page</title>
<meta name="description" content="" />
<meta name="author" content="Mike Britton" />
<meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=no" />
@mbritton
mbritton / app.js
Created March 27, 2013 16:34
Potential organization: Node required?
YUI.add('test-app', function(Y) {
Y.app.TestApp = Y.Base.create('TestApp', Y.App, [], {
apps : {},
start : function() {
if (this.hasRoute(this.getPath())) {
this.dispatch();
} else {
this.replace('/');
}
@mbritton
mbritton / server.js
Created March 28, 2013 14:11
Node Server
var http = require("http"), url = require("url"), path = require("path"), fs = require("fs")
port = 3000;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname, filename = path.join(process.cwd(), uri);
path.exists(filename, function(exists) {
if (!exists) {
@mbritton
mbritton / gist:5272601
Created March 29, 2013 18:24
Snap an element to the mouse
<script>
var mouseIsDown = false;
function init() {
document.onmousedown = function(e) {
mouseIsDown = true;
};
document.onmouseup = function(e) {
mouseIsDown = false;
<!DOCTYPE html>
<html lang="en">
<head>
<title>Basic Phonegap Application</title>
<meta name="description" content="" />
<meta name="author" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
/**
* Provides a CRUD interface to People
*/
app.factory('servicePeople', function ($rootScope) {
var peopleData = {
people: [
{
personID:1,
departmentID:4,
firstName:'John',
shell: {
multiple: {
command: [
'cd <%= cordovaProjectName %>',
'cordova build',
'cordova emulate ios'
].join('&&')
}
}
<html>
<head>
<title></title>
<style>
.tableContainer {
width:100%;
height:100%;
import axios from 'axios'
const xml2js = require('xml2js')
const parseTrack = require('../../node_modules/parse-gpx/src/parseTrack.js')
const trackPoint = require('../../node_modules/parse-gpx/src/TrackPoint.js')
const routes = [
{ id: -1, name: 'Racing Rain, Embracing Pain', gpx: 'Racing_Rain_Embracing_Pain.gpx', county: 'Paulding', description: 'Description' },
{ id: 0, name: 'Sky Loop - Challenge', gpx: 'sky_loop_back_30.gpx', county: 'Paulding', description: 'Description' },
{ id: 1, name: 'Round Rockmart', gpx: 'round_rockmart.gpx', county: 'Polk', description: 'Description' },