This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default Ember.Component.extend({ | |
| data: [], | |
| onInit: Ember.on('init', function() { | |
| this.get('store').findAll('activity').then(results => { | |
| this.set('data', results); | |
| }, err => { | |
| // handle error, couldn't get data... | |
| }) | |
| }), | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = function(app) { | |
| var express = require('express'); | |
| var graphRouter = express.Router(); | |
| var fs = require('fs'); | |
| graphRouter.get('/', function(req, res) { | |
| var arrayOfObjects = fs.readFileSync(__dirname + '/data.json'); | |
| res.send(JSON.parse(arrayOfObjects)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Tinytest.addAsync('slug is changed on update', function (test, done) { | |
| Posts.update(post._id, {$set: {name: 'My new post'}}, function (err) { | |
| // this fails | |
| test.equal(post.name, 'My new post'); | |
| // this too ( it should pass ) | |
| test.equal(post.slug, 'my-new-post', 'slug is my-new-post'); | |
| done(); | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def underscore_and_symbolize(obj) | |
| obj.inject({}) do |hash, (key, val)| | |
| val = underscore_and_symbolize(val) if val.kind_of? Hash | |
| hash[key.underscore.to_sym] = val | |
| hash | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defaults: &defaults | |
| adapter: postgresql | |
| host: localhost | |
| encoding: unicode | |
| pool: 5 | |
| # port: 15432 | |
| development: | |
| <<: *defaults | |
| database: worthit_development |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def underscore_and_symbolize(obj) | |
| obj.inject({}) do |hash, (key, val)| | |
| if val.kind_of? Hash | |
| val = underscore_and_symbolize(val) | |
| end | |
| hash[key.underscore.to_sym] = val | |
| hash | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Api::V1::SessionsController < Devise::SessionsController | |
| respond_to :json | |
| before_filter :authenticate_user!, :except => [:create, :destroy] | |
| skip_before_action :verify_authenticity_token | |
| def create | |
| resource = User.find_for_database_authentication(email: params[:user][:email]) | |
| return invalid_login_attempt unless resource | |
| if resource.valid_password?(params[:user][:password]) | |
| # Generate authentication token unless already exists and save the record. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ( () -> | |
| if typeof angular is 'undefined' | |
| return | |
| module = angular.module 'ApiModel', [] | |
| module.factory 'Api', ($http) -> | |
| baseURL = 'http://asset-campus-housing.herokuapp.com/api/v2/' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def transaction_reports(sort, direction) | |
| gift_type_names = GiftType.select(:name).map(&:name) | |
| gift_type_names.unshift('Untracked Transactions') | |
| reports = gift_type_names.map {|g| { name: g, object: Array.new }} | |
| # Transaction type sql based on event type | |
| transaction_type_sql = case event_type | |
| when 1 # Gala | |
| {:event_id => self.id, :transaction_type_id => 66} | |
| when 2 # Luncheon |