Skip to content

Instantly share code, notes, and snippets.

View orangeeli's full-sized avatar

Eliseu Martinho orangeeli

  • https://fooji.com
  • Lisbon
View GitHub Profile
@orangeeli
orangeeli / rails.init.sh
Last active May 26, 2016 06:24
Starting a rails 5 api app
#!/bin/bash
# --api: flag to create an api only rails app
# --skip-active-record: Removes active record support
# --skip-sprockets: Removes Asset compilation support http://guides.rubyonrails.org/asset_pipeline.html
rails new api-example --api --skip-active-record --skip-sprockets
@orangeeli
orangeeli / parse-handle-error.js
Created May 16, 2016 18:47
A small code snippet of the error handling function for the parse promise failure.
function handleError (res, message) {
return function (error) {
res.json(`${message} ${JSON.stringify(error)}`);
}
};
@orangeeli
orangeeli / include-relation.js
Created December 25, 2015 23:02
A small code snippet that shows how to return items from a relation since include is only for pointer columns (parse.com javascript SDK)
function get(req, res) {
var Foo,
query,
foos;
Foo = Parse.Object.extend("Foo", {}, {});
query = new Parse.Query(Foo);
foos = [];
var cors = require('cloud/lib/cors.js');
app.use(cors());
app.options('*', cors());
var vary = require(‘cloud/lib/vary.js’);
var vary = require(‘vary’);