Skip to content

Instantly share code, notes, and snippets.

Criteria Object

Purpose

A Criteria Object contains the information used to retrieve your desired query results.

Criteria Objects are passed as parameters in the methods that perform CRUD operations, like .find() and .destroy() .

Structure

Criteria objects are composed of Query Pairs. This is what they look like.

Normal Pair
@uncletammy
uncletammy / gist:469e198c1e2c4595e380
Last active August 29, 2015 14:07
rollingReturn
{ identifier: '^gspc',
dataSource: 'yahoo',
lastFetchedMonthlyData: '2014-10-22T17:42:38.450Z',
createdAt: '2014-10-22T17:42:14.828Z',
updatedAt: '2014-10-22T17:42:38.473Z',
id: 34,
rollingReturns:
{ threeYear:
{ returns: { 'year-1': 10.37066, 'year-2': 22.37496, 'year-3': 12.51932 },
growth: { 'year-1': 8962.93, 'year-2': 6957.48, 'year-3': 6086.45 },
// Set hrvst module
var hrvst = angular.module('hrvst');
// Configure UI Router
hrvst.config([
'$stateProvider',
'$urlRouterProvider',
function ($stateProvider, $urlRouterProvider) {
@uncletammy
uncletammy / pet.js
Created November 7, 2014 21:35
One-To-One Associations Issue
/**
* Pet.js
*
* @description :: TODO: You might write a short summary of how this model works and what it represents here.
* @docs :: http://sailsjs.org/#!documentation/models
*/
module.exports = {
attributes: {
@uncletammy
uncletammy / bad groupIds.js
Last active August 29, 2015 14:10
Images not being served by Honey
{ name: 'Veg Lasagna OS', remoteID: '526', groupId: null },
{ name: 'Ginger Glazed Chicken S',
remoteID: '425',
groupId: 425 },
{ name: 'Salmon & Kale Salad S', remoteID: '566', groupId: 566 },
{ name: 'Soup - Red Lentil', remoteID: '900226', groupId: null },
{ name: 'Goat Cheese Cheesecake',
remoteID: '822',
groupId: null },
{ name: 'Moroccan Chick Bowl',
@uncletammy
uncletammy / ruh_ruh.md
Created December 9, 2014 18:40
Problem with current return models for switching to geometric mean calculations

Example return Record

{ product: 1,
    index: null,
    category: null,
    type: 'monthly',
    year: 2007,
 month: 8,
@uncletammy
uncletammy / eSnapRecordExamples.md
Last active August 29, 2015 14:27
Honey API Examples

eSnap Record Examples

Action Route
Location Record location
User Record user
Product Record product

Location Record

/*
ESP8266 CheckFlashConfig by Markus Sattler
This sketch tests if the EEPROM settings of the IDE match to the Hardware
*/
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <Hash.h>
@uncletammy
uncletammy / example.ino
Created March 4, 2016 16:48
ESP8266 Delay in for loops - Websockets
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <WebSocketsClient.h>
#include <Hash.h>
ESP8266WiFiMulti WiFiMulti;
WebSocketsClient webSocket;
void webSocketEvent(WStype_t type, uint8_t * payload, size_t length) {