Skip to content

Instantly share code, notes, and snippets.

@eriktrom
eriktrom / index.js
Created December 16, 2015 19:05
ember-fastboot-render
import Promise from 'bluebird';
import SimpleDOM from 'simple-dom';
import Wreck from 'wreck';
import Redis from 'redis';
import Contextify from 'contextify';
Promise.promisifyAll(Wreck);
Promise.promisifyAll(Redis.RedisClient.prototype);
export default {
@eriktrom
eriktrom / application.controller.js
Last active September 17, 2015 08:42
sendAction problem
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
actions: {
nextVideo() {
console.log('w00t');
}
}

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){

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 / 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
@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 / 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
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,
#=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')