Skip to content

Instantly share code, notes, and snippets.

View robwormald's full-sized avatar

Rob Wormald robwormald

View GitHub Profile
@robwormald
robwormald / Employee.js
Created January 6, 2014 22:58
schema stufss
/**
* Employee
*
* @module :: Model
* @description :: A short summary of how this model works and what it represents.
* @docs :: http://sailsjs.org/#!documentation/models
*/
var uuid = require('node-uuid')
/**
* Global adapter config
*
* The `adapters` configuration object lets you create different global "saved settings"
* that you can mix and match in your models. The `default` option indicates which
* "saved setting" should be used if a model doesn't have an adapter specified.
*
* Keep in mind that options you define directly in your model definitions
* will override these settings.
*
angular.module('myApp').config(['$httpProvider', function($httpProvider) {
delete $httpProvider.defaults.headers.common['X-Requested-With'];
});
#define LAST_VERSION_RUN @"Settings.LastVersionRun"
-(BOOL)isFirstRunForVersion
{
// get the current version
NSString *currentVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"];
// get the last version run
NSUserDefaults* preferences = [NSUserDefaults standardUserDefaults];
NSString *lastVersion = [preferences objectForKey:LAST_VERSION_RUN];
innitApp.provider('API',function(){
//temp storage for new collection
var _collections = []
//holds model references
var _models = {}
return {
//this fires when the provider is injected
$get : ['$resource',function($resource){
@robwormald
robwormald / badRequest.js
Last active January 2, 2016 23:58
new sails error handing....
/**
* 400 (Bad Request) Handler
*
* Usage:
* return res.badRequest(
* 'Please choose a valid `password` (6-12 characters)',
Searching 52 files for "'diplomovaPraceFrontendApp', ["
/Users/robwormald/Downloads/app/scripts/app.coffee:
1 "use strict"
2
3: app = angular.module('diplomovaPraceFrontendApp', [])
4
5 app.config(($routeProvider) ->
/Users/robwormald/Downloads/app/scripts/app.js:
/**
*
*/
module.exports = function destroy (req, res) {
// Locate and validate id parameter
var id = req.param('id');
if (!id) {
return res.badRequest('No id provided.');
}
//angular syntax
//get all dogs
//return all brown dogs
// GET /dogs?color=brown
$http.get('/dogs',{params :{color : 'brown'}}).then(function(dogs){
@robwormald
robwormald / find.js
Last active February 13, 2017 10:01 — forked from Samstiles/find.js
/**
* Find Records
*
* An API call to find and return model instances from the data adapter
* using the specified criteria. If an id was specified, just the instance
* with that unique id will be returned.
*
* @param {Integer|String} id - the unique id of the particular instance you'd like to look up
* @param {Object} where - the find criteria (passed directly to the ORM)
* @param {Integer} limit - the maximum number of records to send back (useful for pagination)