Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / SlimApp.php
Created December 9, 2015 04:22
Slim App : Pod/Controller Based Routing (Slim 2.6)
<?php
class SlimApp extends \Slim\Slim
{
/**
* Route Groups
*
* This is an override for adding the ability to have a callable class
* to allow for a pod structure / tree hierarchy with individual classes
* containing there own sub routers
@AaronGhent
AaronGhent / Vagrantfile
Created January 14, 2016 00:32
Virtual Machine for NodeJS
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.hostname = "nodejs"
config.vm.network :forwarded_port, guest: 3000, host: 3000
config.vm.synced_folder "./", "/home/vagrant/srv", create: true, group: "vagrant", owner: "vagrant"
@AaronGhent
AaronGhent / sync.sh
Last active January 15, 2016 20:17
Sync Latest Downloads From A Remote Server (Ubuntu 14.04)
#!/bin/bash
# requirements: sudo apt-get install lftp
# add to crontab -e
# */15 * * * * sh ~/bin/sync.sh | while read line; do echo "[$(date -R)] $line" >> ~/.log/sync_cron.log; done; 2>&1
server="<<SSH HOST>>"
remote_dir=files/complete
local_dir=/media/dump/
log_file=~/.log/sync.log
username=$LOGNAME
@AaronGhent
AaronGhent / Vagrantfile
Last active May 4, 2016 06:21
Ember CLI Virtual Machine (Ubuntu, Can Run On Windows 7+)
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
ENV["LC_ALL"] = "en_US.UTF-8"
ENV["LC_CTYPE"] = "en_US.UTF-8"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
@AaronGhent
AaronGhent / gin-miniapi.go
Last active February 10, 2021 08:39
golang gin - mini rest api jwt + proxy
package main
## Install
# sudo apt install golang-go
# echo GOPATH=`pwd`
# export GOPATH=`pwd`
# go get -u -v github.com/appleboy/gin-jwt
# go get -u -v github.com/gin-contrib/cors
# go get -u -v github.com/gin-gonic/gin
# go get -u -v github.com/derekparker/delve/cmd/dlv
@AaronGhent
AaronGhent / component.js
Created September 7, 2017 05:03
[EmberJS] Trianglify Component
/* global Trianglify */
import Ember from 'ember';
import ResizeAware from 'ember-resize/mixins/resize-aware';
export default Ember.Component.extend(ResizeAware, {
logTag: '[component:trianglifed-background]',
tagName: 'div',
classNames: ['trianglifed-background'],