Skip to content

Instantly share code, notes, and snippets.

View roguenet's full-sized avatar

Nathan Curtis roguenet

View GitHub Profile
@roguenet
roguenet / gist:9697120
Last active August 29, 2015 13:57
Avoiding Context3D context loss in AIR on iOS when popping CameraRoll.
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
// prevent the cameraroll from showing the status bar, the showing of which causes a context loss in AIR
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}
@roguenet
roguenet / SpreadsheetReader.java
Created July 10, 2013 00:16
Generate JSON data from a Google Spreadsheet
package com.plixl.dashboard.hiddenthings.servlet;
import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
import com.google.gdata.client.spreadsheet.SpreadsheetService;
import com.google.gdata.data.spreadsheet.Cell;
import com.google.gdata.data.spreadsheet.CellEntry;
import com.google.gdata.data.spreadsheet.CellFeed;
import com.google.gdata.data.spreadsheet.SpreadsheetEntry;
import com.google.gdata.data.spreadsheet.WorksheetEntry;
@roguenet
roguenet / 1description.md
Last active December 17, 2015 23:18
Ember authentication without ember-data or ember-auth.

I've been getting my head wrapped around Ember all week, and the biggest problem I kept coming back to is that I couldn't figure out how to accept errors from the server and then route to login when appropriate in a general way. Ember really wants you to only change route from within a Route, and it does not make it easy to get the current Route from elsewhere. This appears to be because if something happens to screw with routing at the wrong time, it's a Badness, so we have to work from within those restrictions.

Long story short, I tried out ember-data and ember-auth and found both a bit too alpha/beta for my tastes at the moment. I'm sure they'll be awesome in the long run, but for now there are enough frustrating quirks and annoyances with what I was trying to do that I decided to roll my own. An excellent writeup by Robin Ward on using ember without ember-data that helped me make that decision.

With this app structure in place, any Route that u

@roguenet
roguenet / gist:5651658
Last active December 17, 2015 18:09
Alpha hit testing with minimal memory impact for a Starling + flump project. The alpha mask generation is super slow in actionscript, recommended to create the mask using similar code in a build process, and add it to the flump .zip for runtime loading instead of runtime generation. The loader here is for flashbang, but it should be easy enough …
package {
import aspire.util.Log;
import aspire.util.Map;
import aspire.util.Maps;
import flash.geom.Rectangle;
import flash.utils.ByteArray;
import flash.utils.getTimer;