Skip to content

Instantly share code, notes, and snippets.

var Waterline = require('waterline');
var sailsMemoryAdapter = require('sails-memory');
// Create the waterline instance.
var waterline = new Waterline();
// Create a specification for a User model.
var userCollection = Waterline.Collection.extend({
identity: 'user',
connection: 'default',
var Waterline = require('waterline');
var sailsMemoryAdapter = require('sails-memory');
var wPsql = require('waterline-postgresql');
// Create the waterline instance.
var waterline = new Waterline();
// Create a specification for a User model.
var userCollection = Waterline.Collection.extend({
identity: 'user',
import Knex from 'knex'
import _ from 'lodash'
import camelize from 'camelize'
import WaterlineSequel from 'waterline-sequel'
import KnexPostgis from 'knex-postgis'
import WaterlineError from 'waterline-errors'
import AdapterError from './error'
import Util from './util'
import SpatialUtil from './spatial'
{ [error: SELEC FROM "user" AS "user" - syntax error at or near "SELEC"]
name: 'error',
length: 86,
severity: 'ERROR',
code: '42601',
detail: undefined,
hint: undefined,
position: '1',
internalPosition: undefined,
internalQuery: undefined,
@edesilets
edesilets / package.son
Created April 1, 2016 20:58
My custom Package
{
"name": "thermal-comfort-system-api",
"version": "1.0.0",
"private": true,
"description": "Packages for my Thermal comfort system project",
"main": "index.js",
"scripts": {
"start": "./express/bin/express server"
},
"repository": {
@edesilets
edesilets / users.js
Created April 6, 2016 14:10
Code as it currently stands. express/app/controllers/users.js
// express/app/controllers/users.js
'use strict';
const debug = require('debug')('thermal-monitor:users');
const controller = require('express/lib/wiring/controller');
const models = require('express/app/models');
const User = models.user;
const crypto = require('crypto');
@edesilets
edesilets / user.js
Created April 6, 2016 14:12
Current Code express/app/models/user.js
// express/app/models/user.js
'use strict';
const bcrypt = require('bcrypt');
const Knex = require("knex")({
client: "pg",
connection: {
host: "localhost",
user: "pi",
password: "password",
@edesilets
edesilets / users.js
Created April 6, 2016 15:42
Abridged express/app/controllers/users.js
const changepw = (req, res, next) => {
debug('Changing password');
let credentials = req.body.passwords;
let search = {
id: req.params.id,
token: req.currentUser.token,
};
new User(search).fetch()
.then((data) => {
if (data) {
@edesilets
edesilets / users.js
Created April 6, 2016 15:44
Updated express/app/models/user.js
'use strict';
const bcrypt = require('bcrypt');
const Knex = require("knex")({
client: "pg",
connection: {
host: "localhost",
user: "pi",
password: "password",
database: "homestatus"
@edesilets
edesilets / nestSummaryToHeatPerHour.php
Created November 23, 2022 15:02
Just messing around trying to get total heating hours out of the google takeout nest summary.json file. What a pain in the ass.
<?php
class MonthlySummary extends Summary {
public function __toString(): string
{
return implode("\n", [
'-------------------------- MONTHLY REPORT --------------------------',
'Month of ' . $this->date . ' contained ' . $this->cycleCounts . ' Heating cycles.',
'For a total of ' . $this->heatingInHours() . " hours.",
"\n"
]);