Skip to content

Instantly share code, notes, and snippets.

View brandonaaskov's full-sized avatar

Brandon Aaskov brandonaaskov

  • Mainframe Labs LLC
  • Maine, USA
View GitHub Profile
@brandonaaskov
brandonaaskov / keycodes-map.coffee
Last active August 29, 2015 13:56
Array of Characters with Keycodes as Indexes
keys = ["","\u0001","\u0002","\u0003","\u0004","\u0005","\u0006","\u0007","\b","\t","\n","\u000b","\f","\n","\u000e","\u000f","\u0010","\u0011","\u0012","\u0013","\u0014","\u0015","\u0016","\u0017","\u0018","\u0019","\u001a","\u001b","\u001c","\u001d","\u001e","\u001f"," ","!","\"","#","$","%","&","'","(",")","*","+",",","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\\","]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~","","€","","‚","ƒ","„","…","†","‡","ˆ","‰","Š","‹","Œ","","Ž","","","‘","’","“","”","•","–","—","˜","™","š","›","œ","","ž","Ÿ"," ","¡","¢","£","¤","¥","¦","§","¨","©","ª","«","¬","­","®","¯","°","±","²","³","´","µ","¶","·","¸","¹","º","»","¼","½","¾","¿","À","Á","Â","Ã","Ä","Å","Æ","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×","Ø","Ù","Ú","Û",
@brandonaaskov
brandonaaskov / .rvmrc
Created September 24, 2014 20:45
.rvmrc file to be used with Fullscreen's Angular/Rails projects
if [ -f "$rvm_path/scripts/rvm" ]; then
source "$rvm_path/scripts/rvm"
VERSION_FROM_GEMFILE=$(perl -ne '/^ruby .([0-9\.]+).$/ && print "$1"' Gemfile)
if [ -f ".ruby-version" ]; then
rvm use `cat .ruby-version`
fi
if [[ -n $VERSION_FROM_GEMFILE ]]; then
rvm use $VERSION_FROM_GEMFILE
@brandonaaskov
brandonaaskov / brigtcove-ama-enhancement.as
Created April 25, 2012 02:25
Enhancing Akamai Media Analytics with Brightcove
_experienceModule = _brightcovePlayer.getModule(APIModules.EXPERIENCE) as ExperienceModule; var modules:Array = _experienceModule.getModules();
for(var i in modules)
{
var modIdentifier:ModuleIdentifier = modules[i];
if(modIdentifier.path.indexOf("http://79423.analytics.edgesuite.net/csma/brightcove/BrightcoveCSMALoader.swf") != -1)
{
//Akamai Module Found
var AkamaiPluginHandle:Object = _experienceModule.getElementByID(modIdentifier.id); //Setting the Custom Information
@brandonaaskov
brandonaaskov / brightcove-js-plugin.js
Created May 10, 2012 13:50
Brightcove JS Plugin Stub
/*
Just a basic sample of a JS plugin that will display the video's name in the console once it initializes.
*/
(function(){
var _experience
, _videoPlayer
, currentVideo;
player = brightcove.api.getExperience();
@brandonaaskov
brandonaaskov / app.js
Created August 22, 2012 16:08
Override DFP Click Through in HTML5 Players in App Cloud Application
/*
* This would live somewhere within the App Cloud application, wherever needed.
*/
//listen for post message from click-through override function
window.addEventListener('message', function (event){
var message = event.data;
if(message.name == 'adClick')
{

Keybase proof

I hereby claim:

  • I am brandonaaskov on github.
  • I am brandonaaskov (https://keybase.io/brandonaaskov) on keybase.
  • I have a public key whose fingerprint is 6FD9 CB8C BBFB 8C1C 4E57 92E1 F290 170D 2EE7 00E8

To claim this, I am signing this object:

@brandonaaskov
brandonaaskov / brightcove-ios-dfp-sample.js
Created March 2, 2013 15:18
Shows a basic example of working with Doubleclick and Brightcove's iOS javascript APIs.
var _adPolicyCreated = false;
var setupVideoAdPolicy = function () {
var advertising = bc.plugins.videoPlayer.advertising,
adServerURL = 'http://ad.doubleclick.net/pfadx/site/zone', //the URL for your ad server (likely will contain dymanic key-value pairs)
adPolicy = {
preRolls: [adServerURL]
},
options = {
adPolicy: adPolicy,
@brandonaaskov
brandonaaskov / js-concept-hoisting.js
Last active December 16, 2015 17:18
Hoisting is an incredibly important javascript concept to understand, and has been explained by people far smarter than I am. But, being able to show a simple example of how hoisting can totally screw you over is key, and that's what this is example shows.
/**
* Hoisting
*
* Wikipedia Article: http://en.wikipedia.org/wiki/Variable_hoisting#hoisting
*
* Hoisting in javascript is pretty simple to understand, and it's incredibly
* important to learn to avoid introducing bugs into your code. Essentially,
* a variable is scoped to the closest function (not a for loop, not an if
* block, a function). This is unlike a lot of other languages where there
* are strict scoping rules, but what's actually happening behind the scenes
@brandonaaskov
brandonaaskov / README.md
Last active September 8, 2016 18:50
This will fix node-oracledb's reference to Oracle Instant Client for El Capitan users. Check the README :)

Note: this isn't my solution, this is simply my findings from many github issues and blog posts coalesced into a single place.

To fix node-oracledb's reference to Oracle Instant Client on El Capitan, you'll need to run this from any repo that has node-oracledb as a dependency. Lines 16 and 17 need to point to the location of your zip files, which can live anywhere but I've kept mine in /opt/oracle.

First, you'll need Oracle Instant Client on your machine. Once you click the environment that suits your needs, you'll need to grab two packages: basic, and sdk. Here's an example for the OSX client.

In the bash file also included with this gist, lines 16 and 17 need to be tweaked to point to those zip files you just downloaded.

Once that's done, you'll need to run it from your repo that has node-oracledb as a dependency. So, for example, let's say I had a folder structure like so:

  • dev
@brandonaaskov
brandonaaskov / docker-clean-none-images.js
Last active October 3, 2016 15:40
Removes all lingering docker images with a repository of <none>
var _ = require('lodash')
var exec = require('child_process').exec
var removeUnnamedDockerImages = function (json) {
_.forEach(json, function (image) {
if (image.repo === '<none>') {
exec('docker rmi -f ' + image.imageId, function (rmErr, rmStdout, rmStderr) {
if (rmErr) {
return console.error(rmErr)
}