Skip to content

Instantly share code, notes, and snippets.

View zephraph's full-sized avatar

Justin Bennett zephraph

View GitHub Profile
@zephraph
zephraph / __init__.py
Last active August 29, 2015 14:00
Quick python script for setting up a new barebones flask workspace
from flask import Flask
app = Flask(__name__)
@zephraph
zephraph / Namespace.js
Last active August 29, 2015 14:11
Javascript namespacing made simple
Namespace = function(scope, definition) {
var root = typeof GLOBAL !== 'undefined' ? GLOBAL : window;
scope = scope.split('.');
for(var i = 0; i < scope.length; ++i) {
if(typeof root[scope[i]] === 'undefined')
root[scope[i]] = {};
root = root[scope[i]];
}
@zephraph
zephraph / singleton.h
Created March 1, 2015 01:48
Inheritable singleton class in C++
#pragma once
#include<iostream>
#include<cstdlib>
template<typename T>
class Singleton
{
public:
inline static T& getInstance()
// Builds out a request function with a default payload
function requestBuilder(api, settings) {
return function request(endpoint, payload) {
payload = $.extend(true, settings, payload || {});
return $.ajax(api + endpoint, payload);
}
}
// -- Imgur Module ----------------------------------------
@zephraph
zephraph / intern-es6.js
Created October 29, 2015 04:19
An example of intern using ES6
import registerSuite from 'intern!object';
registerSuite({
setup() {},
beforeEach() {},
afterEach() {},
teardown() {},
testA() {},
testB() {},
testC() {}
@zephraph
zephraph / t3.template
Last active December 16, 2015 01:42
Could this potentially be linted?
Box.Application.add${ _.capitalize(type) }('${name}', (${type === 'service' ? 'application' : 'context'}) => {
/**
* __ __ ___ ___
* |__) |__) | \ / /\ | |__
* | | \ | \/ /--\ | |___
*
*/
<% if (type !== 'service') { %>
@zephraph
zephraph / SassMeister-input-HTML.html
Created January 19, 2016 02:28
Generated by SassMeister.com.
<div class="EditorialPromo media">
<header class="EditorialPromo media-headline">
Editorial Promo
</header>
</div>
@zephraph
zephraph / SassMeister-input-HTML.html
Created January 26, 2016 16:36
Generated by SassMeister.com.
<div class="EditorialPromo media">
<header class="EditorialPromo media-headline">
Editorial Promo
</header>
</div>
@zephraph
zephraph / SassMeister-input-HTML.html
Last active January 26, 2016 16:37
Generated by SassMeister.com.
<div class="EditorialPromo">
<header class="EditorialPromo-headline">
Editorial Promo
</header>
</div>
@zephraph
zephraph / SassMeister-input-HTML.html
Created January 28, 2016 20:10
Generated by SassMeister.com.
<div class="EditorialPromo EditorialPromo--3up">
<header class="Header">
<h1 class="Header-headline">What We're Loving Now</h1>
<a class="Header-cta" href="#">See More!</a>
<p class="Header-description">A few of the things we like</p>
</header>
<ul class="MediaList">