Skip to content

Instantly share code, notes, and snippets.

App = require 'app'
require 'models/provider'
require 'stores/provider'
# Sample test case
describe 'Provider', ->
describe '#create()', ->
# essentially this is testing that our configuration is working
# so somewhat of a redundant test
it 'should return a new Provider record matching input', ->
@eriktrom
eriktrom / test.coffee
Last active December 17, 2015 18:19 — forked from fayimora/test.coffee
"use strict"
beforeEach ->
Ember.testing = true
afterEach ->
App.reset()
describe "App.ApplicationController", ->
<!doctype html>
<html ng-app="myApp">
<head>
<title>Simple App</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular.js"></script>
</head>
<body>
<div ng-controller="SomeController">
<input type="text"
#=Navigating=
visit('/projects')
visit(post_comments_path(post))
#=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click_on('Button Value')
describe('FizzBuzz', function () {
it('prints "Fizz" for multiples of 3, "Buzz" for 5 and "FizzBuzz" for multiples of 3 or 5', function () {
var expected = [
1,
2,
"Fizz",
4,
"Buzz",
"Fizz",
7,
@eriktrom
eriktrom / for-loop-indirection.js
Created October 23, 2014 21:53
Which version reveals itself as correct immediately? Which is most profitable to use consistently?
// Version 1
var numbers1 = [];
for (var i = 1; i <= 100; i++) {
numbers1.push(i);
}
console.log("numbers1", numbers1);
// Version 2
@eriktrom
eriktrom / gist:a019aeebcf5b937bb4de
Last active August 29, 2015 14:08
Validate Sudoku Board Algorithm
define([], function() {
module("Sudoku");
/*
Write a function that takes a 9x9 array of integers and returns true if the following constraints are met:
1. Each row must contain the numbers 1 to 9.
2. Each column must contain the numbers 1 to 9.
3. Each 3 x 3 local square must contain the numbers 1 to 9
@eriktrom
eriktrom / enumerable_spec.rb
Last active August 29, 2015 14:08
Ruby Enumerable Iterators
require 'active_support/core_ext/string'
RSpec.describe 'Ruby Enumerator Examples' do
def ext_each(enum)
while true
begin
values = enum.next_values
rescue StopIteration => err
return err.result

angular.injector

Creates an injector object that can be used for retrieving services as well as for dependency injection

  // create an injector
  var $injector = angular.injector(['ng']);
  // use the injector to kick off your application
  // use the type inference to auto inject arguments, or use implicit injection
 $injector.invoke(function($rootScope, $compile, $document){
@eriktrom
eriktrom / angular-source-notes.md
Created February 3, 2015 16:05
angular-testing-notes.md

angular.injector

Creates an injector object that can be used for retrieving services as well as for dependency injection

  // create an injector
  var $injector = angular.injector(['ng']);
  // use the injector to kick off your application
  // use the type inference to auto inject arguments, or use implicit injection
 $injector.invoke(function($rootScope, $compile, $document){