Skip to content

Instantly share code, notes, and snippets.

View davemorro's full-sized avatar

David Morrison davemorro

View GitHub Profile
@JosephAllen
JosephAllen / TriggerFramework-SFDC.md
Last active April 30, 2023 08:29
Salesforce Trigger Framework
@chlab
chlab / README.md
Last active April 28, 2021 09:48
vue webpack boilerplate: how to add env-specific build targets

When using the vue-webpack-boilerplate, you will have only a production build by default (besides dev and test setups). My team often has at least another environment we call "staging" where the client can test new features before we move them to production. Oftentimes, these environments will have env-specific config values, like a different API URL.

With the changes outlined below, you can create a separate config per environment. This assumes you've created a Vue.js project with vue-webpack-boilerplate.

  1. Apply the changes to the corresponding files in your project as outlined below
  2. Now, when you run npm run build staging it will build your project with the config values specific to your staging environment. You can easily add any number of other environments and build them the same way. npm run build or npm run build production will still build your production environment.
@davestewart
davestewart / CarLoader.js
Created October 24, 2017 16:32
Example of a Vuex service
import Vue from 'vue'
import _ from 'lodash'
import { compare, stringify } from 'utils/query'
import store from 'app/store'
/**
* Car loader service
*
* Removes responsibility of loading cars from the results store
*
@mediavrog
mediavrog / gist:49c4f809dffea4e00738a7f5e3bbfa59
Last active June 20, 2024 18:13
CORS in Google Cloud Functions for Firebase
const cors = require('cors')({origin: true});
exports.sample = functions.https.onRequest((req, res) => {
cors(req, res, () => {
res.send('Passed.');
});
});
@akiyamaSM
akiyamaSM / books.html
Last active August 27, 2017 18:34
How to Manage lists using vueJs
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.26/vue.js"></script>
</head>
<body>
<div id="app">
<label>Name</label> <input type="text" id="name" v-model="newBook.name" /> <br />
<label>Author</label> <input type="text" id="author" v-model="newBook.author" /> <br />
<label>Pages</label> <input type="text" id="author" v-model="newBook.totalPages" /> <br />

Mobile Safari's 100% Height Dilemma

Whether you're developing a web application with native-ish UI, or just a simple modal popup overlay that covers the viewport, when it comes to making things work on iDevices in Mobile Safari, you're in for a decent amount of pain and suffering. Making something "100% height" is not as easy as it seems.

This post is a collection of Mobile Safari's gotchas and quirks on that topic, some with solutions and fixes, some without, in good parts pulled from various sources across the internets, to have it all in one place. Things discussed here apply to iOS8, iOS9 and iOS10.

The Disappearing Browser Chrome

Screen real estate on smartphones is limited, so Mobile Safari collapses the browser chrome (address bar and optional tab bar at the top, and tool bar at the bottom) when the user scrolls down. When you want to make something span exactly the height of the viewport, or pin something to the bottom of the screen, this can get tricky because the viewport changes size (or

@chrisjhoughton
chrisjhoughton / README.md
Last active May 19, 2023 04:36
Notify tray workflows "webhook style" from Salesforce using Apex triggers.

Salesforce Apex trigger notifications for tray.io

Salesforce's Apex triggers allow you to trigger tray workflows in real-time, based on events that occur in Salesforce. Events include things like:

  • New lead creations
  • Opportunity updates, such as the status moving from "open" to "closed"

Salesforce doesn't support webhooks out of the box, so we'll need to add some Apex code to your Salesforce account to notify tray at the right time.

@rgrove
rgrove / README.md
Created February 8, 2016 19:01
Cake's approach to React Router server rendering w/code splitting and Redux

Can't share the complete code because the app's closed source and still in stealth mode, but here's how I'm using React Router and Redux in a large app with server rendering and code splitting on routes.

Server

  1. Wildcard Express route configures a Redux store for each request and makes an addReducers() callback available to the getComponents() method of each React Router route. Each route is responsible for adding any Redux reducers it needs when it's loaded. (This isn't really necessary on the
@sararob
sararob / upvote-security-rules.json
Created August 25, 2015 17:25
Upvoting example for Firebase security rules
{
"rules": {
".read": true,
"articles": {
"$article": {
"title": {
".write": "auth != null",
".validate": "newData.isString() && newData.val() != ''"
},
"url": {
@katowulf
katowulf / FirebaseQueryWrapper.js
Created July 31, 2015 20:10
Wrap a Firebase Query to include a toString with the parameters.
// Not all API methods are implemented in this proof
// See https://www.firebase.com/docs/web/api/query/
var FirebaseQueryWrapper = (function() {
function FirebaseQueryWrapper(url) {
this.ref = new Firebase(url);
this.parms = {};
}
var proto = FirebaseQueryWrapper.prototype;