Skip to content

Instantly share code, notes, and snippets.

require 'spec_helper'
feature 'delphius user creates a chart of accounts' do
scenario "successfully", js: true do
sign_in_as_delphius_user
chart_of_accounts = new_chart_of_accounts
chart_of_accounts.create
chart_of_accounts.has_been_created
end
require 'benchmark'
def multiples(end_of_range)
multiple_sum = 0
multiples_of_three = 0
while multiples_of_three < end_of_range
multiple_sum += multiples_of_three
multiples_of_three += 3
end
@JFickel
JFickel / bootstrap_modals.js
Last active August 29, 2015 13:57
EmberJS Bootstrap Modal Question
// I'm using a cookbook recipe from http://emberjs.com/guides/cookbook/user_interface_and_interaction/using_modal_dialogs/
// I've got this action in my Ember.ApplicationRoute:
openModal: function() {
this.render("processing", {
into: 'application',
outlet: 'modal'
});
}
attr = DS.attr;
Gameway.User = DS.Model.extend({
name: attr('string'),
email: attr('string'),
lolAccount: DS.belongsTo('lolAccount'),
avatarUrl: attr('string'),
teams: DS.hasMany('team', { async: true })
})
attr = DS.attr;
Gameway.Tournament = DS.Model.extend({
name: attr('string'),
bracketId: attr('string'),
bracket: function() {
this.store.find('bracket', this.get('bracketId')).then(function(bracket) {
debugger;
}, function(error) {
debugger;
for (matchIndex = 0; matchIndex < matchCount; matchIndex++) {
isMatchIndexEven = matchIndex % 2 ? undefined : true;
nextMatchIndex = Math.floor(matchIndex/2);
nextRoundIndex = this.roundCount() - reverseIndex;
builtRounds.findBy('index', nextRoundIndex).get('matches').then(function(matches) {
return matches.findBy('index', nextMatchIndex);
}).then(function(nextMatch) {
nextMatch.get('matchups').then(function(matchups) {
nextMatchup = matchups.findBy('top', isMatchIndexEven);
match = thisStore.createRecord('match', { index: matchIndex, nextMatchupId: nextMatchup.get('id'), round: round });
attr = DS.attr;
function shuffle(o){
for(var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
return o;
};
Gameway.Bracket = DS.Model.extend({
// tournamnetId formatting wasn't being picked up for some reason by the serializer
// it looks like i'll have to refer to it in this format
var WebSocketServer = require('ws').Server;
var http = require('http');
var port = process.env.PORT || 5000;
var server = http.createServer();
// this does nothing
server.on('request', function(req, res) {
console.log("HEADERS SHOULD BE HERE?")
console.log(req.headers);
})
<!DOCTYPE html>
<html>
<body>
<script>
var parseQueryString = function( queryString ) {
var params = {}, queries, temp, i, l;
// Split into key/value pairs
queries = queryString.split("&");
Failures:
1) User pages signup with valid information followed by signout
Failure/Error: before { click_link("Sign out") }
Capybara::ElementNotFound:
no link with title, id or text 'Sign out' found
# (eval):2:in `click_link'
# ./spec/requests/user_pages_spec.rb:55:in `block (5 levels) in <top (required)>'
Finished in 0.78348 seconds