Skip to content

Instantly share code, notes, and snippets.

defmodule Johnann do
def john(n) when n >= 1 do
john_and_ann(n)[:john]
end
def ann(n) when n >= 1 do
john_and_ann(n)[:ann]
end
@PandaWhisperer
PandaWhisperer / sicp-ch1.sc
Last active May 3, 2016 03:06
SICP Chapter 1 Exercises https://repl.it/CKty/4
;;--------------;;
;; Exercise 1.1 ;;
;;--------------;;
10
;=> 10
(+ 5 3 4)
;=> 12
(- 9 1)
;=> 8
(/ 6 2)
# LinkedList implementation as given in the problem assignment
class LinkedList
attr_accessor :payload, :next_element
def initialize(payload, next_element)
@payload, @next_element = payload, next_element
end
end
# output_list implementation as given in the problem assignment
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 test.localhost
> Aditive@0.0.0 start /Users/chris/Work/Aditive/aditive-backend
> nodemon app.js
[nodemon] 1.8.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node app.js`
warn: Sails' built-in layout support only works with the `ejs`, `handlebars`, `ractive` view engines.
warn: You're using `jade`.
warn: Ignoring `sails.config.views.layout`...
require 'rails_helper'
feature 'Managing users' do
given(:user) { create(:user) }
given(:admin) { create(:admin_user) }
context 'as an Admin' do
background do
login_as admin
user # reference user to ensure it exists
* guard-rspec (4.6.4)
* rspec (3.3.0)
* rspec-core (3.3.2)
* rspec-expectations (3.3.1)
* rspec-mocks (3.3.2)
* rspec-rails (3.3.3)
* rspec-support (3.3.0)
ruby '2.0.0'
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.4'
# Use PostegreSQL
gem 'pg'
# Use Slim for templates
gem 'slim-rails'
# We need SASS support for some jQuery plugins
> fomo@0.0.0 test /Users/chris/Code/fomo-server
> PORT=9999 NODE_ENV=testing _mocha ./test/bootstrap.test.js ./test/unit/*.test.js ./test/unit/**/*.test.js -r should --timeout 60000
warn: Sails' built-in layout support only works with the `ejs`, `handlebars`, `ractive` view engines.
warn: You're using `jade`.
warn: Ignoring `sails.config.views.layout`...
Connecting Mongoose to mongodb://localhost:27017/fomo
function pick(obj, ...keys) {
if (typeof obj !== 'object') return;
var result = {};
for (var key of Object.keys(obj)) {
if (keys.indexOf(key) >= 0) result[key] = obj[key];
}
return result;
}