Skip to content

Instantly share code, notes, and snippets.


Rob Wormald robwormald

View GitHub Profile
View gist:8984028
module.exports = {
index: function (req,res) {
//empty object hold the data
var viewData = {}
viewData.user = req.user;
File.find( function foundFiles(err, files) {
View data.js
// in the old data model, you had to do a bunch of crufty bullshit
$scope.messages = Messages.all();
$scope.$onRootScope('messages.updated', function() {
$scope.messages = Messages.all();
// ew, what's even going on there? Well, it loads the data from the Messages service,
// but then has to wait for an event to make sure it actually updates when the data changes.
// Like a peasant.
View p.js
//opt 1
return SomeService.manipulateStuff(stuff);
//do stuff...
//opt 2
//do stuff...
View userAndRole.js
// user.js
module.exports = {
schema: true,
attributes: {
name: {
type: 'string',
required: true
View thing.js
var myApp = angular.module('myApp');
myApp.service('Auth', function($http) {
this.onLoginSuccess = function(loginResponse){
return ({success:1, msg: "Logged in refreshing ....", type:"success"})
this.onLoginFailure = function(loginError){
return ({success:0, msg: "LError Loggin in", type:"danger"})
View qBootstrap.js
//bluebird promise lib >>>> anything
var q = require('bluebird');
module.exports.bootstrap = function(cb) {
//returns a promise
var findOrCreateForm = function(){
return Form.find().then(function(forms){
if(forms.length > 0){
return forms;
View CityController.js
* CityController
* @description :: Server-side logic for managing cities
* @help :: See
module.exports = {
View ctrl.js
View JWT.js
app.factory('JWT', JWT);
function JWT($window, $q){
var store = $window.localStorage;
var key = 'AXC_API_Storage.Token';
var service = {
getToken: getToken,
View t.js
//returns array of users
function getUser(){
return fetch('user.json');
function getAccountsForUser(user){
return fetch(`users/${}/accounts`);
function getPropertiesForAccount(account){