Skip to content

Instantly share code, notes, and snippets.

View warrendodsworth's full-sized avatar

Warren Dodsworth warrendodsworth

View GitHub Profile
@katowulf
katowulf / firebase.json
Last active March 1, 2024 21:32
Example of Firebase emulator unit tests and seed Firestore data
{
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"emulators": {
"firestore": {
"port": 8080
}
}
@Ryderpro
Ryderpro / sheetformulas.md
Last active August 23, 2020 21:11
Helpful Google Sheet Formulas

Helpful Google Sheet Formulas

Convert ISO DateTime into date value

A1 = "2019-01-01T00:20:00"
=datevalue(left(A1,10))+TIMEVALUE(mid(A1,12,8))
returns 43466.01389

Convert ISO DateTime into date with inherited cell format

A1 = "2019-01-01T00:20:00"
=TO_DATE(datevalue(left(a1,10))+TIMEVALUE(mid(a1,12,8)))

@navix
navix / readme.md
Last active November 23, 2022 09:18
Prevent leaving from any page using Router in Angular 7

Prevent leaving from any page using Router in Angular 7

Angular has CanDeactivate guard, but you have to declare it to each path in the routes configuration.

Valid until angular/angular#11836 will be done.

You can use CanActivateChild guard to prevent leaving from any component with single declaration.

leave-guard.service.ts

@JoniJnm
JoniJnm / date-fns-date-adapter.ts
Created January 4, 2019 11:44
date-fns angular material adapter
import {Injectable} from '@angular/core';
import {DateAdapter} from '@angular/material';
import {addDays, addMonths, addYears, format, getDate, getDaysInMonth, getMonth, getYear, parse, setDay, setMonth, toDate} from 'date-fns';
// CONFIG. Use environment or something for a dynamic locale and settings
import {es as locale} from 'date-fns/locale';
const WEEK_STARTS_ON = 1; // 0 sunday, 1 monday...
export const MAT_DATE_FNS_DATE_FORMATS = {
@Ryderpro
Ryderpro / postLead.js
Created September 26, 2018 01:42
Transform Squarespace leads in Google Sheets to TripleSeat form leads.
/**
* Post SquareSpace form entry to TripleSeat Form API.
*
* 0a. SquareSpace is connected to the SquareSpace form sheet.
* 0b. When a user makes a form entry in SquareSpace it is sent to a Google Sheet
*
* 1. This is a special function that looks for rows in this GoogleSheet that have not been "sent".
* 2. This function then sends a POST request with the form data to TripleSeat.
* 3. Then this function updates "TripleSeat Status" field to "Sent" in each row that was sent to TripleSeat.
* 4. Create a trigger in this project to run this function every 5 minutes, add yourself for script failure notifications
@Zyzle
Zyzle / luxon-date-adapter.spec.ts
Last active November 12, 2020 14:11
Luxon date adaptor for angular material
import { LOCALE_ID } from '@angular/core';
import { async, inject, TestBed } from '@angular/core/testing';
import { DateAdapter, MAT_DATE_LOCALE, MAT_DATE_FORMATS } from '@angular/material/core';
import { DateTime, Settings } from 'luxon';
import { LuxonDateAdapter, LUXON_DATE_FORMATS } from './luxon-date-adapter';
// avoid confusion when working with months
@vinknee
vinknee / MailChimpExample.gs
Last active May 12, 2021 06:58
Google Script to interact with MailChimp API v3.0
var API_KEY = 'XXXXXXX';
var API_USER = 'anystring';
var mc_list_id = 'XXXXX'; //List ID found in list settings
// Using adding members with custom signup forms in this example
var mc_base_url = 'https://us14.api.mailchimp.com/3.0/lists/' + mc_list_id + '/members';
//var mc_send = 'https://us14.api.mailchimp.com/3.0/automations/XXXX/emails/XXXXX/queue';
/**
* Used to convert email to MD5 hash to allow auto update of user information with MailChimp 3.0 API w/ PUT
*/
@akirattii
akirattii / app.js
Created November 27, 2017 03:34
Example: Server-Sent Event (SSE) + expressjs
/*
0) start node app:
$ node app.js
1) start stream listening:
browse to http://localhost:3000/
2) stop stream listening:
browse to http://localhost:3000/stop
*/
@kkrishnan90
kkrishnan90 / FirebasePhoneAuthIonicV3.md
Last active September 8, 2021 13:24
Firebase Phone Auth using Ionic V3 - Sending and reading OTP

General Steps to be followed as a flow process to complete Firebase Phone OTP Auth in Ionic V3

Step 1 : Get the phone number through input from the user. Step 2 : Pass this phone number to the firebase and receive a callback with verification ID. Step 3 : Pass on this verification ID through navParams to the next page where the user will enter the OTP sent to the entered mobile number. Step 4 : Verify the OTP that is sent with firebase for success() or failure() .

STEP 1 & 2 & 3

phone-verification.html

Disable Device Enrollment Notification on Mac.md

Restart the Mac in Recovery Mode by holding Comment-R during restart

Open Terminal in the recovery screen and type

csrutil disable