Skip to content

Instantly share code, notes, and snippets.

View joachimhs's full-sized avatar

Joachim Haagen Skeie joachimhs

View GitHub Profile
@joachimhs
joachimhs / gist:5278104
Created March 30, 2013 19:54
Simple QUnit test
var appController;
var inputDate = new Date(2013,2,27,11,15,00);
module("EurekaJ.AppController", {
setup: function() {
Ember.run(function() {
appController = EurekaJ.__container__.lookup("controller:application");
});
},
@joachimhs
joachimhs / gist:5273519
Created March 29, 2013 20:44
run-qunit.js
var interval = null;
var args = phantom.args;
if (args.length < 1 || args.length > 2) {
console.log("Usage: " + phantom.scriptName + " <URL> <timeout>");
phantom.exit(1);
}
var page = require('webpage').create();
page.onConsoleMessage = function(msg) {
if (msg.slice(0, 8) === 'WARNING:') {
Even though JavaScript have matured significantly over the last five years, there is still a couple of areas where you will most definitely notice that you are working with a project that still have some maturing to do. Testing is definitely one of these areas, leaving a lot of the decisions required up to the application developers. This chapter will attempt to outline how you can successfully test your own Ember.js applications while looking at a real world implementation of one possible test harness.
As with applications written in other languages, there are multiple way to test your application, including:
• Unit Testing
• Integration Testing
• Performance Testing
• Regression Testing
• Black Box Testing
• Continuous Integration
Naturally, you might not need to implement a solution for all of these testing types in your own application. Chances are, though, that you might need several of them, where unit testing and integration testing are the most common types of test harnesses you will find f
@joachimhs
joachimhs / gist:5253672
Created March 27, 2013 11:58
assembled
This file has been truncated, but you can view the full file.
/*
* Date Format 1.2.3
* (c) 2007-2009 Steven Levithan <stevenlevithan.com>
* MIT license
*
* Includes enhancements by Scott Trenda <scott.trenda.net>
* and Kris Kowal <cixar.com/~kris.kowal/>
*
* Accepts a date, a mask, or a date and a mask.
* Returns a formatted version of the given date.
@joachimhs
joachimhs / gist:5253158
Created March 27, 2013 10:06
QUnit test
var appController;
module("EurekaJ.AppController", {
setup: function() {
appController = EurekaJ.ApplicationController.create();
},
teardown: function() {
}
});
@joachimhs
joachimhs / gist:5249832
Created March 26, 2013 22:19
Riak object
{
"guiPath": "JSFlotJAgent:Memory:Heap:Used",
"accountName": "ACCOUNT",
"hoursSince1970": 378981,
"metrics": [
22780440,
23524272,
23936024,
24203536,
24806664,
@joachimhs
joachimhs / gist:5232023
Created March 24, 2013 13:44
Slideshow Ember.run.schedule
EME.PhotoControlsController = Ember.Controller.extend({
needs: ['photoList'],
slideshowTimerId: null,
playSlideshow: function() {
console.log('playSlideshow');
var controller = this;
controller.nextPhoto();
this.set('slideshowTimerId', setInterval(function() {Ember.run.schedule('timers', controller, 'nextPhoto')}, 4000));
},
@joachimhs
joachimhs / gist:5171629
Created March 15, 2013 17:36
Riak Not Deleting
package org.eurekaj.plugins.riak.dao;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import org.eurekaj.api.dao.TreeMenuDao;
import org.eurekaj.api.datatypes.Statistics;
import org.eurekaj.api.datatypes.basic.BasicStatistics;
@joachimhs
joachimhs / gist:5147483
Last active December 14, 2015 20:58
Defining view-properties
EurekaJ.TreeView = Ember.View.extend({
items : null,
controller : Ember.Controller.create(),
init : function() {
this._super();
this.set('controller._allowSelectionOfNonLeafNodes', this.get('allowSelectionOfNonLeafNodes'))
this.set('controller._allowMultipleSelections', this.get('allowMultipleSelections'))
},
@joachimhs
joachimhs / gist:5080480
Last active December 14, 2015 11:39
Cassandra Out of Memory
I've set up a 3-node cluster (Cassandra 1.2.0) and a column family with a replication factor of 3.
I've also created a StackOverflow question for this topic: http://stackoverflow.com/questions/15198413/cassandra-running-out-of-memory
The Column family is called metric_hour and hold 15-second average values for one hour
with column names:
- account name
- metric name
- value type (string)