Skip to content

Instantly share code, notes, and snippets.

View rynbyjn's full-sized avatar
🤘
metal

Ryan Boyajian rynbyjn

🤘
metal
  • Denver, CO
View GitHub Profile
@rynbyjn
rynbyjn / gist:969544
Created May 12, 2011 21:56
AS3 Code 128 Barcode Generation in Air
// I've only tested this with one code 128 font that I found here: http://freebarcodefonts.dobsonsw.com/
// it's a .ttf so it can be embedded in your app
public static function getBarcode( $rawData :String ) :String
{
var offset :Number = 32;
var highAscii :Number = 18;
var total :Number = 104;
var i :uint;
var len :uint;
var newCodeString :Vector.<Number> = new Vector.<Number>( $rawData.length + 3 );
@rynbyjn
rynbyjn / build.properties
Created May 12, 2011 22:55
AS3 Air 2.6 Ant build files iDevice Android
# SDK Stuff
FLEX_HOME = /PATH_TO_FLEX_SDK_DIR_OVERLAID_W_AIR_2.6
flex_libs = ${FLEX_HOME}/frameworks/libs
air_libs = ${flex_libs}/air
mxmlc = ${FLEX_HOME}/lib/mxmlc.jar
air_adl = ${FLEX_HOME}/bin/adl
air_adt = ${FLEX_HOME}/lib/adt.jar
# Project and current version
project.name = ProjectName
@rynbyjn
rynbyjn / AccelerometerAccess.as
Created May 12, 2011 23:09
AS3 Air Accelerometer base class with Signal for shaking the device
package com.client.projectname.device
{
import com.greensock.TweenLite;
import org.osflash.signals.Signal;
import flash.events.AccelerometerEvent;
import flash.sensors.Accelerometer;
/**
@rynbyjn
rynbyjn / LazySusan.as
Created May 13, 2011 21:49
AS3 LazySusan/Carousel class for moving objects around a circle with pseudo 3D
package com.boyajian.ui
{
import com.greensock.TweenLite;
import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
import flash.display.Sprite;
import flash.display.Stage;
import flash.events.Event;
@rynbyjn
rynbyjn / heroku.rake
Created July 16, 2013 17:57
Use heroku pgbackups to restore local database with staging/production data.
APP_NAME = 'INSERT_DEVIL_WORSHIPPING_APP_NAME_HERE'
namespace :heroku do
namespace :db do
namespace :pull do
desc "Pulls staging db to local."
task :staging => :environment do
pull_db_locally("#{APP_NAME}-staging", "#{APP_NAME}_development")
end
desc "Pulls production db to local."
@rynbyjn
rynbyjn / CDVSplashScreen+Overrides.h
Last active December 22, 2015 20:29
Category to fix PhoneGap 2.x CDVSplashScreen for updated iOS7 status bar rendering.
//
// CDVSplashScreen+Overrides.h
//
// Created by boyajian on 9/10/13.
//
//
#import "CDVSplashScreen.h"
@interface CDVSplashScreen (Overrides)
@rynbyjn
rynbyjn / google_maps_stub.coffee
Created January 4, 2014 00:28
Create spy objects for jasmine testing.
eventMethods = [
'Ga',
'Ke',
'Nj',
'Og',
'T',
'addDomListener',
'addDomListenerOnce',
'addListener',
'addListenerOnce',
@rynbyjn
rynbyjn / object_byte_size
Created February 13, 2014 22:33
Calculate rough size of an object in javascript (bytes)
roughSizeOfObject: (object) ->
objectList = []
stack = [object]
bytes = 0
while stack.length
value = stack.pop()
if typeof value is "boolean"
bytes += 4
else if typeof value is "string"
bytes += value.length * 2
@rynbyjn
rynbyjn / android_google_maps.rake
Last active August 29, 2015 13:57
Rake tasks for generating a SHA1 for use with the google maps API for Android.
# keystore vars
keystore = 'path_to_your.keystore'
keystore_alias = 'alias_for_your_keystore'
keystore_password = 'password_for_your_keystore'
namespace :android do
namespace :google do
namespace :maps do
desc 'Generates a debug SHA1 specific to your machine.'
task :debug_sha do
@rynbyjn
rynbyjn / email_validator
Created April 24, 2014 23:27
Simple regex email validator
/(.+)@(.+)\.([a-z]{2,})/