Skip to content

Instantly share code, notes, and snippets.

View mplatts's full-sized avatar

Matt Platts mplatts

View GitHub Profile
@mplatts
mplatts / 0firebase_functions_cheatsheet.js
Last active October 31, 2023 22:15
Firebase functions cheatsheet
// Core
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
const db = admin.database();
admin.auth().createUser({
uid: uid,
displayName: displayName,
photoURL: photoURL
@mplatts
mplatts / contacts.rb
Last active February 20, 2017 22:48
Rest properties fields
{
:alpha => "WILL L", # user.rest_alpha ?
:name => "Lynne Williams", # user.first_name, user.last_name
:leasename => "Lynne Williams", # ???
:leaseshortname => "Lynne Williams", # ???
:postalline1 => "27B Fisher Avenue", # user.address_line_one
:postalline3 => "Southport Qld 4215", # user.address_line_two
:tenantsuburb => "Southport", # user.suburb
:tenantstate => "Qld", # user.state
:tenantpcode => 4215, # user.postcode
@mplatts
mplatts / meteor_browser_policy.js
Last active October 12, 2015 04:58
Meteor browser policy
// First install the browser policy package:
// meteor add browser-policy
BrowserPolicy.framing.disallow();
BrowserPolicy.content.disallowInlineScripts();
BrowserPolicy.content.disallowEval();
BrowserPolicy.content.allowInlineStyles();
BrowserPolicy.content.allowFontDataUrl();
// Change these to whatever services your app needs access to
@mplatts
mplatts / example.com.conf
Last active October 6, 2015 01:51
Meteor nginx
server {
# Internet traffic will come in on port 80
listen 80;
# Apply only to traffic heading to example.com
# NOTE: change to your domain name
server_name example.come;
# When things are going wrong we can check the logs
access_log /var/log/nginx/app.dev.access.log;
@mplatts
mplatts / boot-4-cheat.txt
Last active September 27, 2015 04:08
Bootstrap 4 cheatsheet
a - all
t - top
b - bottom
l - left
r - right
x - left and right
y - top and bottom
m-t = margin-top: 1em
m-t-md = margin-top: 1.5em
// Usage:
//
// var video = videojs('video_id');
// video.iframeSeek();
//
// To start the player at 30s
// $iframe[0].contentWindow.postMessage('startTime:30', '*')
//
(function(window, videojs) {
@mplatts
mplatts / error.js
Created August 26, 2015 02:59
Meteor error explanation
// see http://docs.meteor.com/#/full/meteor_error
var error = new Meteor.Error('error-name', 'reason');
alert(error) //=> Error: reason [error-name]
alert(error.reason) //=> reason
alert(error.error) //=> error-name
// Explanation.. alert(error) is the same as going alert(error.toString()), which results in "Error: error.reason [error.error]"
@mplatts
mplatts / underscore.coffee
Created June 4, 2015 12:45
Underscore options
array = [1,2,3,4]
_.each array, (item) ->
console.log item
# OR
_(array).each (item) ->
console.log item
@mplatts
mplatts / background-workers.coffee
Created June 4, 2015 07:15
meteor background job - recurring
if Meteor.isServer
class @TestJob extends Job
@setupCron: (parser) ->
parser.text('every 5 seconds')
handleJob: ->
console.log 'Job complete'
@mplatts
mplatts / background-workers.coffee
Created June 4, 2015 06:47
background job using meteor workers
if Meteor.isClient
Template.hello.events
'click button': ->
Meteor.call('loadJob')
if Meteor.isServer
class @TestJob extends Job
handleJob: ->
console.log 'Job complete'