Skip to content

Instantly share code, notes, and snippets.

View kidGodzilla's full-sized avatar
👋
Working from home forever

James Futhey kidGodzilla

👋
Working from home forever
View GitHub Profile
@kidGodzilla
kidGodzilla / concise-dll.js
Created May 13, 2015 07:18
Doubly-Linked List
/**
* **************************************************************************************
* dll: A Concise Doubly-Linked List Object
*
* Author: James Futhey <futhey@gmail.com>, 2015
* 277 characters
*
* Each node contains a value and up to two objects, representing the previous (p) and
* next (n) object in the list, if applicable.
*
@kidGodzilla
kidGodzilla / LICENSE.txt
Last active August 29, 2015 14:26 — forked from LeverOne/LICENSE.txt
generate random v4 UUIDs (107 bytes)
DO WTF YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Alexey Silin <pinkoblomingo@gmail.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WTF YOU WANT TO PUBLIC LICENSE
@kidGodzilla
kidGodzilla / flattenArrays.js
Created August 10, 2015 09:03
A couple of functions to flatten arrays, with tests. See http://jsbin.com/zoqorudoka/edit?js,console
/**
* Test Inputs
*/
a = [[1,2,[3.23,4,"dfger",[5]]],4];
a2 = [[[[[0]], [1]], [[[2,5,6], [3]]], [[4], [5]]]];
/**
* Recursively flatten an array
*/
function flatten (array) {
@kidGodzilla
kidGodzilla / responsive-text.css
Last active August 29, 2015 14:27
Simple, declarative responsive text classes
/* Responsive text */
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-justify { text-align: justify; }
@media (max-width: 768px) {
.text-left-xs { text-align: left; }
.text-right-xs { text-align: right; }
.text-center-xs { text-align: center; }
@kidGodzilla
kidGodzilla / deduce-type.php
Last active August 29, 2015 14:27
Deduce a value's type from a stringified version of that value
// Deduce Type
// James Futhey, 2015
//
// Useful for parsing a $_GET or $_POST value and knowing it's MySQL-compatible type
function deduceType ($value) {
if (strlen(strval($value)) === 0) {
return "null";
}
if ($value === "true" || $value === "false") {
@kidGodzilla
kidGodzilla / bootstrap-grid.css
Created September 4, 2015 19:54
Bootstrap - Just the grid
@-ms-viewport {
width: device-width;
}
.visible-xs,
.visible-sm,
.visible-md,
.visible-lg {
display: none !important;
}
.visible-xs-block,
@kidGodzilla
kidGodzilla / style.css
Last active October 10, 2015 16:38
Example CSS Styles for the Ember 2 blog example application
@import url(//fonts.googleapis.com/css?family=Lato:300,400,300italic,400italic);
@import url(//fonts.googleapis.com/css?family=Merriweather:300italic,300,700,700italic);
@import url(//fonts.googleapis.com/css?family=Montserrat:400,700);
body {
width: 60%;
margin-left: 20%;
font-family: 'Merriweather', serif;
font-weight: 300;
font-size: 18px;
@kidGodzilla
kidGodzilla / client-side-recommendation-engine.js
Last active November 13, 2016 00:18
Client-side Javascript Recommendation Engine
/****************************************************
* Core.js
***************************************************/
function needsNew() {
throw new TypeError("Failed to construct: Please use the 'new' operator, this object constructor cannot be called as a function.");
}
/**
* a Generic core object
@kidGodzilla
kidGodzilla / deferred-execution.js
Last active April 4, 2016 20:51
Deferred Javascript Execution Class: Defer the execution of a bit of Javascript until a condition is met
var deferredExecutionTimers = window.deferredExecutionTimers = {};
function s4 () {
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
}
function deferExecution (condition, callback, interval) {
if (!deferredExecutionTimers) window.deferredExecutionTimers = {};
import Ember from 'ember';
export default Ember.Component.extend({
filter: null,
filteredList: null,
actions: {
autoComplete() {
this.get('autoComplete')(this.get('filter'));
},
search() {