Skip to content

Instantly share code, notes, and snippets.

View coding4funrocks's full-sized avatar
🏠
Working from home

coding4funrocks

🏠
Working from home
View GitHub Profile
@coding4funrocks
coding4funrocks / addDeviceFormController.js
Last active June 12, 2016 08:43
LEAN Raspberry Remote client-side snippets
raspberryRemoteApp.controller('addDeviceFormController', function ($scope, $http, $location) {
$scope.master = {};
$scope.addFormStatus = '';
$scope.update = function (device) {
console.log(device);
$http.post('http://localhost:1337/api/devices', device)
.success(function () {
$scope.device = angular.copy($scope.master);
@coding4funrocks
coding4funrocks / adddevice.js
Created June 12, 2016 08:49
LEAN Raspberry Remote server-side snippets
var device = args.device.value;
var newDevice = devices.insert(device);
newDevice.id = newDevice.$loki;
newDevice.state = false;
devices.ensureUniqueIndex('id');
db.saveDatabase();