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/ .
@rhys-vdw
rhys-vdw / paginate.coffee
Last active March 8, 2016 16:07
Poor man's knex/bookshelf pagination
Promise = require 'bluebird'
defaultPageSize = 20
paginate = (knex) -> (query, paginationOptions, options) ->
if query.fetchAll?
model = query
query = model.query()
@SaladFork
SaladFork / _instructions.md
Last active April 14, 2016 16:52
Mocha Reporter (+blanket.js)
  1. Put reporter.js in tests/helpers/reporter.js
  2. Change tests/test-helper.js to look like the attached
  3. Put test-container-styles.css in vendor/ember-cli-mocha to override the default
  4. Stop your server and restart (it doesn't watch vendor/ by default)
@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.
@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);
@ryanlabouve
ryanlabouve / ember-deploy-notes.md
Last active January 27, 2017 09:48
Ember Deploy Notes (s3 and redis)
// Notes from our previous deploy strategy

CI for Ember-CLI App using

Using ember-cli-deploy we will deploy our Ember(-cli) app to S3 (and cloudfront), Redis via github and codeship.

Since skill-set's may vary, set's start by breaking this down at a high level:

@saschwarz
saschwarz / app.module.ts
Last active March 12, 2018 11:33
Rollbar JS in Angular 4/Typescript
...
import { RollbarService, RollbarErrorHandler, rollbarFactory } from './rollbar';
@NgModule({
...
providers: [
{
provide: ErrorHandler,
useClass: RollbarErrorHandler
},
@eliotsykes
eliotsykes / current-route-query-params-ember-component.js
Last active November 13, 2019 13:06
How to get the current route, queryParams, etc. in an Ember component
// Examples
// Yes, "router.router" twice - this assumes that the router is being injected
// into the component. Otherwise lookup 'router:main'
// One of these will be of interest, figure out which one you want:
this.get('router.router.state');
this.get('router.router.state.params');
this.get('container').lookup('controller:application').currentPath;
@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
******************************************************************************/
@dongseok0
dongseok0 / azure-storage-promisify.js
Last active February 24, 2020 02:03
Promisify Azure storage service
// Use function that Async keyword appended
Bluebird.promisifyAll(blobService, {
promisifier: (originalFunction) => function (...args) {
return new Promise((resolve, reject) => {
try {
originalFunction.call(this, ...args, (error, result, response) => {
error && reject(error);
resolve({result, response});
});
} catch (e) {