Skip to content

Instantly share code, notes, and snippets.

View techwraith's full-sized avatar

Daniel Erickson techwraith

View GitHub Profile
{
"name": "Aldric Stormwind",
"description": "Aldric Stormwind is a human wizard known for his arcane mastery and scholarly pursuits.",
"type": "person",
"metadata": {
"race": "Human",
"age": 45,
"gender": "Male",
"occupation": "Wizard",
"socialStatus": "Comfortable",
@techwraith
techwraith / api-handler.go
Last active March 1, 2020 05:17
A go module for parsing a todo list
package todo
import (
"encoding/json"
models "path/to/your/module/models"
"net/http"
)
// IndexHandler returns a todo list
func IndexHandler(w http.ResponseWriter, r *http.Request) {
var Renderer = function () {
var self = this
, requestAnimationFrame = window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.msRequestAnimationFrame
this.queue = {}
requestAnimationFrame(function () {
@techwraith
techwraith / component.css
Created July 6, 2016 19:21
Using css modules compose inside media queries.
.container {
compose: row from './flex.css';
}
@media (min-width: 768px) {
.container {
compose: column from './flex.css'
}
}
module.exports = function (path, opts) {
return function (err, src) {
if (!opts) opts = {}
if (!path) throw new Error('Path must be provided')
if (err) {
throw err
window.$ = require('jquery-browserify')
var Switcher = require('ribcage-switcher')
var Base = require('ribcage-view')
var switcher = new Switcher({depth: 2, el: $('body')})
switcher.setPane(0, new Base({}))
switcher.setPane(1, new Base({}))
switcher.render()
@techwraith
techwraith / index.js
Created November 13, 2013 05:29
requirebin sketch
window.$ = require('jquery-browserify')
var Switcher = require('ribcage-switcher')
var Base = require('ribcage-view')
var switcher = new Switcher({depth: 2, el: $('body')})
switcher.setPane(0, new Base({}))
switcher.setPane(1, new Base({}))
switcher.render()
geddy.model.Conversation.first(params.id, function(err, conversation) {
geddy.model.Message.all({conversationId: conversation.id}, {includes: [ 'users']}
, function (err, messages) {
conversation.messages = messages;
});
})
@techwraith
techwraith / app.js
Last active December 18, 2015 22:29
var Backbone = require('backbone')
, example = require('./routes/example.js')
, _ = require('lodash');
var App = Backbone.router.extend({
initialize: function () {
this.route('example', _.bind(example, this))
}
});
@techwraith
techwraith / index.js
Created February 17, 2013 03:09
voxel.js game
var createGame = require('voxel-engine')
var simplex = require('voxel-simplex-terrain')
var url = require('url')
var chunkSize = 32
var chunkDistance = 3
var seed
var parsedURL = url.parse(window.location.href, true)
if (parsedURL.query) seed = parsedURL.query.seed