Skip to content

Instantly share code, notes, and snippets.

View lholmquist's full-sized avatar

Lucas Holmquist lholmquist

View GitHub Profile
@lholmquist
lholmquist / gist:3757334
Created September 20, 2012 17:48
aerogear Datamanager recordId bug?
//this is extracted from app.js from my modified TODO app
//First Create a datamanager
var dm = aerogear.dataManager([ "tasks", "tags", "projects"]),
TasksValve = dm.valves[ "tasks" ],
ProjectsValve = dm.valves[ "projects" ],
TagsValve = dm.valves[ "tags" ];
//at this point if you do
@lholmquist
lholmquist / datamanager_remove
Created September 21, 2012 18:50
datamanger remove
///Already Updated https://github.com/aerogear/TODO/commit/9af0ee9f5f155c76d359e6d55d6e46d25d4a31de
//extracted from app.js of TODO
//Remove
switch( type ) {
case "project":
options.valves = ProjectsValve;
Projects.remove( options );
@lholmquist
lholmquist / dm_memory_adapter
Created September 24, 2012 20:32
Datamanger Memory Adapter
//When a field has multiple values, the filter method of the Memory Data Adapter won't work
//Here is some example data
userValve.save([
{
id: 12351,
fname: "Luke",
lname: "Public",
dept: [ "Accounting", "IT" ]
@lholmquist
lholmquist / filterMethodLogic
Created September 25, 2012 18:45
Datamanger Memory Adapter - Filter Logic
//should this return 1 or 2 values? and yes this is out of order, not suppose to be real code
var filtered = tasksValve.filter( { tags: 111 } );
//the datamanager for this example
var tasksValve = aerogear.dataManager( "tasks" ).valves.tasks;
tasksValve.save([
{
id: 12345,
date: "2012-07-30",
//was - worked
securePipe.read({
error: function( data, message ) {
equal( message, "Error: Authentication Required", "Initial Page load Auth Failure" );
start();
}
});
@lholmquist
lholmquist / piplinejsonp
Created October 10, 2012 17:01
Pipeline jsonp
//https://github.com/lholmquist/WoWAerogear if you have yeoman installed, you should be able to do yeoman server, might have to do yeoman build first though
//excerpt from app.js
pipeline.add( {
name: "wowPipe",
settings: {
baseURL: "http://us.battle.net/api/wow/",
endpoint: "achievement/2144", //this should be in the read method, need datamanager for that?
jsonp: true,
@lholmquist
lholmquist / todoerrors
Created October 11, 2012 16:26
TODO errors
This is based off the most recent branch of the TODO app( my fork ) located here: https://github.com/lholmquist/TODO
start jboss server
run: mvn clean install on TODO app
access TODO app at http://localhost:8080/todo
log in with john/123
@lholmquist
lholmquist / gist:4072589
Created November 14, 2012 14:59
Trailing slash
//Taken from the AeroGearExample
tasksPipe = [todo pipe:^(id<AGPipeConfig> config) {
[config name:@"status"];
[config endpoint: @"realm/status"]; //endpoint with no trailing slash
[config type:@"REST"];
}];
//when i do the read, i get a 404, since the URL has a trailing slash on it
[tasksPipe read:^(id responseObject) {
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
@lholmquist
lholmquist / ag-crossdomain.md
Created December 6, 2012 19:17
Aerogear.js Crossdomain

This gist relates to AEROGEAR-534, https://issues.jboss.org/browse/AEROGEAR-534

I created a node.js server that handles CORS and jsonp for my testing

###Cross Domain Support

To do cross domain request, i've modified aerogear.js a bit.

I've added a new settings variable, settings.crossdomain, that can be mixed. If set to true, it will default to CORS, to override to jsonp set settings.crossdomain.type = "jsonp"