Skip to content

Instantly share code, notes, and snippets.

View coderberry's full-sized avatar

Eric Berry coderberry

View GitHub Profile
/**
* User.js
*
* @description :: TODO: You might write a short summary of how this model works and what it represents here.
* @docs :: http://sailsjs.org/#!documentation/models
*/
"use strict";
var bcrypt = require('bcrypt');
/**
* User.js
*
* @description :: TODO: You might write a short summary of how this model works and what it represents here.
* @docs :: http://sailsjs.org/#!documentation/models
*/
"use strict";
var bcrypt = require('bcrypt');
@coderberry
coderberry / app.js
Created July 28, 2014 13:39
Example of using es6-promise in Node to perform asynchronous API calls.
var express = require('express');
var Promise = require('es6-promise').Promise;
var http = require('http');
var app = express();
var getJSON = function(options) {
console.log('CALLING ' + options['host']);
var promise = new Promise(function(resolve, reject) {
var req = http.get(options, function(res) {
@coderberry
coderberry / app.js
Last active April 1, 2016 17:49
Example of using Ember's RSVP in Node to perform asynchronous API calls.
var express = require('express');
var RSVP = require('rsvp');
var http = require('http');
var app = express();
var getJSON = function(options) {
console.log('CALLING ' + options['host']);
var promise = new RSVP.Promise(function(resolve, reject) {
var req = http.get(options, function(res) {
curl -i \
-X POST \
-H "Accept: applicaton/json" \
-d "token=1b2ec27cc2a950fc795f5960239fjs1b& \
is_test=true& \
ip_addres=98.202.120.35& \
first_name=Jane& \
last_name=Example& \
email=jane.example@cege.com& \
phone_1=8015554321& \
@coderberry
coderberry / db.rake
Created July 10, 2014 14:46
rake db:migrate:reset_all
namespace :db do
namespace :migrate do
desc "runs db:drop db:create db:migrate for both development and test environments"
task :reset_all do
system('bundle exec rake db:migrate:reset')
system('bundle exec rake db:migrate:reset RAILS_ENV=test')
end
end
end
.wrapper_table{
display: table;
width:100%;
}
.wrapper_row{
display:table-row;
vertical-align:top;
}
.wrapper_cell{
display:table-cell;
@coderberry
coderberry / ember-ratchet-mobile.md
Created June 26, 2014 22:00
Instructions to creating a hybrid mobile app with EmberCLI and Ratchet

Building Guru App with EmberCLI

Example app found at http://goo.gl/K0Lf61

This app requires EmberCLI to be installed. You can install it via npm using npm install -g ember-cli

$ ember new guru-app
$ cd guru-app
module LearnLti
class ApplicationController < ActionController::Base
before_action :set_default_headers
before_filter :cors_preflight_check
after_filter :cors_set_access_control_headers
def set_default_headers
response.headers['X-Frame-Options'] = 'ALLOWALL'
end
@coderberry
coderberry / partners_ctrl.js
Created May 20, 2014 15:57
partners_ctrl.js
var app = angular.module('app', []);
app.controller('PartnersCtrl', ['$scope', function($scope) {
$scope.partnerLevels = window.ENV['PARTNER_LEVELS'];
$scope.partners = window.ENV['PARTNERS'];
$scope.partnerTypes = window.ENV['PARTNER_TYPES'];
$scope.markets = window.ENV['MARKETS'];
$scope.solutionCategories = window.ENV['SOLUTION_CATEGORIES'];
$scope.currentPartnerType = null;
$scope.currentMarket = null;