Skip to content

Instantly share code, notes, and snippets.

View thoov's full-sized avatar
🤔
Is the Kool-Aid man the glass part or the liquid?

Travis Hoover thoov

🤔
Is the Kool-Aid man the glass part or the liquid?
View GitHub Profile
@thoov
thoov / cookie.js
Created May 21, 2011 18:24
Javascript Cookie Functions
@thoov
thoov / flatten.php
Created November 8, 2011 07:48
Flatten and Inflate n-dimensional arrays in php.
<?php
private function flatten($array, $base = "", $div_char = "/")
{
$ret = array();
if(is_array($array))
{
foreach($array as $k => $v)
{
if(is_array($v))
@thoov
thoov / js_invocation_types.js
Last active December 17, 2015 11:39
Javascript Invocation Types
/*
There are four patterns of invocation in JavaScript:
- the method invocation pattern
- the function invocation pattern
- the constructor invocation pattern
- the apply invocation pattern
The patterns differ in how the bonus parameter this is initialized.
function Promise(promise) {
if (promise instanceof Promise) {
return promise;
} else {
// this is a new promise chain
this.callbacks = [];
}
}
Promise.prototype.then = function(callback_ok, callback_error) {
@thoov
thoov / zeroFill.js
Last active December 23, 2015 00:38
Zero fill a javascript array
// 20 is the number of zero filled places
var zeroFilledArray = new Array( 20 ).join( "0" ).split("");
@thoov
thoov / application.hbs
Last active August 29, 2015 14:24
Ember Table built with compossible components. https://github.com/emberjs/ember.js/issues/11124
{{#my-table model=arrayOfData as |table|}}
{{#my-column table=table header='FirstName'}}
{{firstName}}
{{/my-column}}
{{#my-column table=table header='LastName'}}
{{lastName}}
{{/my-column}}
import Ember from 'ember';
import stateFor from 'ember-state-services/state-for';
export default Ember.Controller.extend({
data: stateFor('todos', 'model')
});
@thoov
thoov / components.foo-bar.js
Created June 18, 2016 17:31
Render Function
import Ember from 'ember';
const { get } = Ember;
export default Ember.Component.extend({
name: 'Travis',
didReceiveAttrs() {
this._super(...arguments);
FROM node:8.5
WORKDIR /app
ADD . /app
RUN npm -q install
RUN npm -q install -g ember-cli
EXPOSE 4200
EXPOSE 49152

Keybase proof

I hereby claim:

  • I am thoov on github.
  • I am thoov (https://keybase.io/thoov) on keybase.
  • I have a public key ASAbTcXto41w5gbslX6GC-d4VowkgCUXiPmSfOYNJK1P4go

To claim this, I am signing this object: