Skip to content

Instantly share code, notes, and snippets.

View jamesdixon's full-sized avatar

James Dixon jamesdixon

View GitHub Profile
@simenbrekken
simenbrekken / deployment.sh
Last active January 25, 2016 22:17
Codeship Azure Website Custom Deployment Script
# $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/ .
@lukemelia
lukemelia / index.js
Created April 4, 2015 04:49
ember-cli livereload, ssl and nginx (file from an in-repo addon)
'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
@danharper
danharper / 1-sleep-es7.js
Created February 8, 2015 16:55
ES7's async/await syntax.
// ES7, async/await
function sleep(ms = 0) {
return new Promise(r => setTimeout(r, ms));
}
(async () => {
console.log('a');
await sleep(1000);
console.log('b');
})()
@Samsinite
Samsinite / array.js
Created January 26, 2015 04:47
Array transform for ember-data
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);
@rafaelveloso
rafaelveloso / plv8-javascript-modules-loading.sql
Last active December 6, 2019 14:21
How to load Javascript modules into postgres using plv8
/******************************************************************************
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
******************************************************************************/
@kristianmandrup
kristianmandrup / Converting libraries to Ember CLI addons.md
Last active April 21, 2023 17:14
Guide to Developing Addons and Blueprints for Ember CLI

Converting libraries to Ember CLI addons

In this guide we will cover two main cases:

  • Ember specific library
  • vendor library

Ember 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.

@clhenrick
clhenrick / README.md
Last active April 1, 2024 14:55
PostgreSQL & PostGIS cheatsheet (a work in progress)
@colingourlay
colingourlay / example.js
Last active October 22, 2021 15:16
Lodash / Underscore sort object keys. Like _.sortBy(), but on keys instead of values, returning an object, not an array. Defaults to alphanumeric sort.
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}
@sararob
sararob / data-structure.js
Last active April 26, 2022 22:21
Role-based security in Firebase
/*
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
@ericeslinger
ericeslinger / document.coffee
Last active May 13, 2016 21:09
Add side-loads to BookshelfJS
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.