Skip to content

Instantly share code, notes, and snippets.

var _loadTheme = function (themeName) {
var directory = new NativeFileSystem.DirectoryEntry(themeName);
//TODO : need util API for combining paths
var themePath = THEME_DIRECTORY + themeName;
NativeFileSystem.requestNativeFileSystem(
themePath,
function (directoryEntry) {
/*
* Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
/*
* Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
@mikechambers
mikechambers / gist:3341668
Created August 13, 2012 15:14
Objective-C / Cocoa JSON
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"glossary" ofType:@"json"];
NSData *data = [NSData dataWithContentsOfFile:filePath];
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
NSMutableArray *entries = [json objectForKey:@"entries"];
[
{
"name":"Ball of Cookie Dough",
"level":"50",
"ingredients":[
{
"name":"Stick of Butter",
"amount":"1"
},
{
@mikechambers
mikechambers / example.html
Created October 11, 2012 20:36
Example Handlebars template
<div class="toolbar simple-toolbar-layout">
<div class="title">{{JSLINT_ERRORS}}</div>
</div>
<div class="table-container">
<table class="zebra-striped condensed-table" id="jslint-error-tab">
<tbody>
{{#each errors}}
<tr class="lint-error-row" data-index="{{this.index}}">
<td>{{this.error.line}}</td>
@mikechambers
mikechambers / paper.js
Created November 19, 2012 19:29
Paper.js Drawing Example
var thickness;
var strokeColor;
var text = new PointText(new Point(300, 200));
text.content = "Click and Drag to Draw";
text.characterStyle = {
fontSize:36,
fillColor:"#777777",//new RgbColor(119,119,119);
font:"Arial"
};
@mikechambers
mikechambers / easel.js
Created November 19, 2012 19:30
Easel.js Drawing Example
var stage;
var isMouseDown;
var currentShape;
var oldMidX, oldMidY, oldX, oldY;
var txt;
function init() {
txt = new createjs.Text("Click and Drag to Draw", "36px Arial", "#777777");
txt.x = 300;
txt.y = 200;
var buildMenu = function (m) {
m.addMenuDivider();
m.addMenuItem(CONVERT_UPPERCASE);
m.addMenuItem(CONVERT_LOWERCASE);
m.addMenuDivider();
m.addMenuItem(CONVERT_HTML_ENCODE);
m.addMenuItem(CONVERT_HTML_DECODE);
m.addMenuDivider();
m.addMenuItem(CONVERT_DOUBLE_SINGLE);
m.addMenuItem(CONVERT_SINGLE_DOUBLE);
@mikechambers
mikechambers / node_async_child_process_generic.js
Last active December 31, 2015 02:39
Couple of examples showing how to call multiple functions asynchronously in series using the async library. Examples also show how to pass arguments to the functions being called in series (look at the second function).
var async = require("async");
var child_process = require("child_process");
var config = {};
config.PROCESS_TIMEOUT = 10000;
//these need to return functions to be executed.
var processExecuter = function(processName, args, callback) {
var cmd = child_process.execFile(
processName,