Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

coding4funrocks

🏠
Working from home
View GitHub Profile
@coding4funrocks
coding4funrocks / adddevice.js
Created Jun 12, 2016
LEAN Raspberry Remote server-side snippets
View adddevice.js
var device = args.device.value;
var newDevice = devices.insert(device);
newDevice.id = newDevice.$loki;
newDevice.state = false;
devices.ensureUniqueIndex('id');
db.saveDatabase();
@coding4funrocks
coding4funrocks / addDeviceFormController.js
Last active Jun 12, 2016
LEAN Raspberry Remote client-side snippets
View addDeviceFormController.js
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);