Skip to content

Instantly share code, notes, and snippets.

@AaronGhent
AaronGhent / hadoken.js
Created January 12, 2015 02:34
hadoken easter egg
/*
Hadoken Easter Egg
Author: Aaron Ghent
*/
/* global $ */
var hadoken = function() {
if($('.hadoken').length > 0) {
return;
@AaronGhent
AaronGhent / adnetwork.js
Last active August 29, 2015 14:08
adNetwork (raptorize adoption easter egg)
import Em from 'ember';
var locked = false;
var adNetwork = function(imagePath, options) {
function run() {
var ImageMarkup = '<img id="adNetwork" style="display: none" src="' + imagePath + '" />';
var defaults = {
css: {
@AaronGhent
AaronGhent / NativeObjectMixin.js
Last active August 29, 2015 14:08
Ember.NativeObjectMixin - Converts Ember Objects into Native JavaScript Objects
import Ember from 'ember';
var NativeObjectMixin = Ember.Mixin.create({
toNative: function() {
var properties = [];
for (var key in this) {
var types = ['string', 'number', 'boolean'];
if (types.contains(Ember.typeOf(this[key]))) {
@AaronGhent
AaronGhent / ModelSaveRelationsMixin.js
Created July 22, 2014 08:01
ModelSaveRelationsMixin.js
/**
* Creates a mixin that saves hasMany relations (this comes in handy when filtering tree data)
*
* @class ModelSaveRelationsMixin
* @main ModelSaveRelationsMixin
* @constructor
*/
/*
@AaronGhent
AaronGhent / EmberArrayAsync.js
Last active August 29, 2015 14:04
EmberArrayAsync.js
/**
* @main EmberArrayAsync
*/
/**
* forEachAsync iterates over a large array gradually. The function
* will process items in the array for a given number of ms, stop iterating for
* a given wait time, then proceed and wait until the iteration is complete.
*
* @method forEachAsync
/**
* @name: Modal Mixin
* @framework: Ember.JS
* @author: Aaron Ghent
*/
App.ModalMixin = Ember.Mixin.create({
defaultModal: 'modal',
modalsOpen: {},
actions: {
@AaronGhent
AaronGhent / p4merge mercurial intergration
Last active January 3, 2016 12:59
p4merge mercurial intergration
[ui]
merge = p4merge
[extensions]
hgext.extdiff =
[extdiff]
cmd.p4diff = p4merge
[tortoisehg]
@AaronGhent
AaronGhent / p4merge install
Created January 17, 2014 01:02
Installs p4merge on a linux based machine
# p4merge for 64 bit
wget http://www.perforce.com/downloads/perforce/r13.4/bin.linux26x86_64/p4v.tgz
# p4merge for 32 bit
# wget http://www.perforce.com/downloads/perforce/r13.4/bin.linux26x86/p4v.tgz
tar zxvf p4v.tgz
sudo cp -r p4v-* /usr/local/p4v/
sudo ln -s /usr/local/p4v/bin/p4merge /usr/local/bin/p4merge
@AaronGhent
AaronGhent / embedded_records_mixin.js
Last active December 30, 2015 05:19
Embedded Objects Mixin Works with the RESTSerializer
var get = Ember.get;
var forEach = Ember.EnumerableUtils.forEach;
/**
The EmbeddedRecordsMixin allows you to add embedded record support to your
serializers.
To set up embedded records, you include the mixin into the serializer and then
define your embedded relations.
```js
@AaronGhent
AaronGhent / sync_models.py
Created October 26, 2012 02:29
Sync Django Models Properly
# >><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><< #
# Sync's models against database
# >><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><< #
from cStringIO import StringIO
import sys
import re
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")