Skip to content

Instantly share code, notes, and snippets.

View DominicFinn's full-sized avatar

Dominic Finn DominicFinn

View GitHub Profile
@DominicFinn
DominicFinn / onProspectingStudentCreated.js
Created March 28, 2023 11:53
Event handlers handling fire store documents create / updated
const functions = require("firebase-functions");
const IterableDataService = require('../../iterable/IterableDataService');
module.exports = functions.firestore.document('prospecting-student/{email}').onCreate(async (snap, context) => {
const student = snap.data();
const result = await IterableDataService.putUserData({
email: snap.id,
userId: student.uuid,
dataFields: {
@DominicFinn
DominicFinn / index.js
Last active March 28, 2023 11:52
Different behaviour for different firebase functions
const functions = require("firebase-functions");
const express = require("express");
let staticValue = { message: 'Hello World!' }
// you don't want this then as it will be a single instance of helloWorld_app. You don't really have control when the instance is up or down unless
// you configure that in the function with "minInstances" etc
const app = express();
app.get('/short', (req, res) => {
@DominicFinn
DominicFinn / escrow.sol
Created February 28, 2022 21:52
Escrow contract
pragma solidity ^0.5.2;
contract Escrow {
// the person who will pay the funds
address public payer;
// the person who will recieve funds
address public payee;
// the lawyer / solicitor, controller of the funds
@DominicFinn
DominicFinn / index.html
Created January 25, 2021 14:55
YouTube / Vimeo Parallax
<div class="jarallax" data-jarallax data-jarallax-video="https://www.youtube.com/watch?v=F3I0wRGAkxo">
<div class="demo-table">
<div class="demo-table-cell">
<h1>Just Another Parallax <small>[Jarallax]</small></h1>
<h2>Background Video Parallax (YouTube &amp; Vimeo)</h2>
<br>
<a class="github-button" href="https://github.com/nk-o/jarallax" data-style="mega" data-count-href="/nk-o/jarallax/stargazers" data-count-api="/repos/nk-o/jarallax#stargazers_count" data-count-aria-label="# stargazers on GitHub" aria-label="Star nk-o/jarallax on GitHub">Star</a>
<a class="github-button" href="https://github.com/nk-o/jarallax/archive/master.zip" data-style="mega" aria-label="Download nk-o/jarallax on GitHub">Download</a>
</div>
docker-compose up
using System;
using System.Collections.Generic;
namespace ResultThings
{
internal class Result
{
public bool Success { get; }
@DominicFinn
DominicFinn / GoogleCalendarObjects_Users.cs
Created April 22, 2020 16:38
The various User classes taken from the Google APIs helper lib. Kind of a picking list as the majority is just noise
/// <summary>JSON template for User object in Directory API.</summary>
public class User : Google.Apis.Requests.IDirectResponseSchema
{
[Newtonsoft.Json.JsonPropertyAttribute("addresses")]
public virtual System.Collections.Generic.IList<UserAddress> Addresses { get; set; }
/// <summary>Indicates if user has agreed to terms (Read-only)</summary>
[Newtonsoft.Json.JsonPropertyAttribute("agreedToTerms")]
public virtual System.Nullable<bool> AgreedToTerms { get; set; }
@DominicFinn
DominicFinn / DeepViewModel.cs
Last active April 21, 2020 14:49
Avoid this
using System;
namespace DeepObjects.Models
{
internal enum CatStatus
{
Outstanding
}
internal sealed class CatDetails
@DominicFinn
DominicFinn / rating.html
Created April 15, 2020 19:28
Star Rating
<div class="rating">
<span></span><span></span><span></span><span></span><span></span>
</div>
<div>
<p id="output"></p>
</div>
<script>
let ratingStars = [...document.querySelectorAll('.rating span')].map((s, i) => {
@DominicFinn
DominicFinn / ReadAName.cs
Created December 1, 2019 11:51
Reading a name and seeing what it begins with
using System;
namespace leanne
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter name!");
var name = Console.ReadLine();