Skip to content

Instantly share code, notes, and snippets.

View manniresystems's full-sized avatar

manniresystems

View GitHub Profile
const securos = require('securos');
// let vivotekCam = {
// url: "ws://192.168.15.15:888",
// id: "7",
// totalIn: 0,
// totalOut: 0
// };
let vivotekCams = [
import express, { Router, Request } from 'express';
import admin from 'firebase-admin';
admin.initializeApp({
credential: admin.credential.applicationDefault()
});
const db = admin.firestore();
const router = Router()
router.get('/', async (req, res, next) => {
@signalpoint
signalpoint / example.php
Last active February 5, 2025 19:23
Drupal 8 Set Message Example
<?php
// The drupal_set_message() function is being deprecated!
// @see https://api.drupal.org/api/drupal/core%21includes%21bootstrap.inc/function/drupal_set_message/8.5.x
// > Deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0.
// > Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.
// In some custom code.
\Drupal::messenger()->addMessage('Say something else');
@ademilter
ademilter / compound-query.js
Last active September 7, 2019 20:29
Firestore #firebase
var citiesRef = db.collection("cities");
var query = citiesRef.where("capital", "==", true);
citiesRef.where("state", "==", "CA")
citiesRef.where("population", "<", 100000)
citiesRef.where("name", ">=", "San Francisco")
citiesRef
.where("state", "==", "CA")
@saintplay
saintplay / counter.function.js
Last active October 17, 2021 17:00
Add counter for Firestore Collection
// functions/income/counter.function.js
'use strict'
const functions = require('firebase-functions')
const admin = require('firebase-admin')
// Prevent firebase from initializing twice
try { admin.initializeApp(functions.config().firebase) } catch (e) {}
@jasonbyrne
jasonbyrne / php
Last active March 1, 2023 10:39
Beginnings of a Firestore CRUD Library for PHP
<?php
namespace PHPFireStore {
class FireStoreDocument {
private $fields = [];
private $name = null;
private $createTime = null;
private $updateTime = null;
@JoeRoddy
JoeRoddy / FirebaseToFirestore.js
Created October 18, 2017 16:19
Convert Firebase Database JSON to Firestore Collections
var db = firebase.firestore();
var content = require("./sourceData.json");
content &&
Object.keys(content).forEach(contentKey => {
const nestedContent = content[contentKey];
if (typeof nestedContent === "object") {
Object.keys(nestedContent).forEach(docTitle => {
firebase
.firestore()
@davebeach
davebeach / NewUserRegisterForm.php
Created June 1, 2017 07:52 — forked from davidDuymelinck/NewUserRegisterForm.php
Extend drupal 8 user register form
<?php
namespace Drupal\my_module\Form;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\Entity\EntityFormBuilderInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
function lotus_cron() {
$result = \Drupal::entityQuery("user")
->condition('login', strtotime('-6 months'), '<=')
->execute();
$storage_handler = \Drupal::entityTypeManager()->getStorage("user");
foreach ($result AS $user) {
$entity = $storage_handler->load($user);
@slivorezka
slivorezka / get_image_path_with_image_style.php
Created November 8, 2016 10:40
Drupal 8: Get Image URL / URI with Image Style
<?php
use Drupal\file\Entity\File;
use Drupal\image\Entity\ImageStyle;
// File ID.
$fid = 123;
// Load file.
$file = File::load($fid);
// Get origin image URI.
$image_uri = $file->getFileUri();
// Load image style "thumbnail".