In this guide we will cover two main cases:
- Ember specific library
- vendor library
The Ember library will assume that Ember has already ben loaded (higher in the loading order) and thus will assume it has access to the Ember API.
| # $AZURE_REPO_URL needs to be set in your projects Variables section | |
| # and include both username and password, e.g: https://username:password@site.scm.azurewebsites.net:443/site.git | |
| # Clone Azure repository | |
| git clone $AZURE_REPO_URL ~/azure | |
| cd ~/azure | |
| # Replace repository contents | |
| rsync --archive --delete --exclude ".*" ~/clone/public/ . |
| 'use strict'; | |
| /* | |
| ember-cli's live-reload doesn't work out of the box for our configuration | |
| because we run in local dev using www.yapp.dev over SSL. We use nginx to | |
| terminate SSL and reverse proxy appropriate requests to ember-cli. | |
| A configuration that gets live-reload working is implemented by this | |
| addon plus nginx rules. This addon includes a script tag in index.html | |
| as defined by the `contentFor` method below. Our standard nginx config |
| // ES7, async/await | |
| function sleep(ms = 0) { | |
| return new Promise(r => setTimeout(r, ms)); | |
| } | |
| (async () => { | |
| console.log('a'); | |
| await sleep(1000); | |
| console.log('b'); | |
| })() |
| import Ember from 'ember'; | |
| import DS from 'ember-data'; | |
| export default DS.Transform.extend({ | |
| serialize: function(deserialized) { | |
| return !!deserialized ? deserialized.toArray() : null; | |
| }, | |
| deserialize: function(serialized) { | |
| return Ember.A(serialized); |
| /****************************************************************************** | |
| How to load Javascript modules into postgres | |
| ******************************************************************************/ | |
| CREATE EXTENSION IF NOT EXISTS plv8 | |
| /****************************************************************************** | |
| First step is download the Javascript module file | |
| Example with undescore-min and node-jpath | |
| ******************************************************************************/ |
This is a collection of information on PostgreSQL and PostGIS for what I tend to use most often.
| var obj = {b: 3, c: 2, a: 1}; | |
| _.sortKeysBy(obj); | |
| // {a: 1, b: 3, c: 2} | |
| _.sortKeysBy(obj, function (value, key) { | |
| return value; | |
| }); | |
| // {a: 1, c: 2, b: 3} |
| /* | |
| This example shows how you can use your data structure as a basis for | |
| your Firebase security rules to implement role-based security. We store | |
| each user by their Twitter uid, and use the following simplistic approach | |
| for user roles: | |
| 0 - GUEST | |
| 10 - USER | |
| 20 - MODERATOR |
| Knex = require 'knex' | |
| Promise = require 'bluebird' | |
| FlormModel = require './flormModel' | |
| Document = FlormModel.extend | |
| tableName: 'documents' | |
| # here's an example sideload construct. I want to know document editor ids, which are stored in the | |
| # edges join table - that table stores parent_id and child_id polymorphically (with parent_type and child_type) | |
| # also polymorphically with join type- 'grant: edit' denotes editorship. |