Skip to content

Better Feedback - 5 min? O.o

Feedback lets you understand what is happening, why things are what they are, and what is possible. It needs to be fast, easily accessible, and relevant.

View sql.xml
<?xml version="1.0" encoding="utf-8" ?>
<!-- SQL XML created by WWW SQL Designer, -->
<!-- Active URL: -->
<datatypes db="mysql">
<group label="Numeric" color="rgb(238,238,170)">
<type label="Integer" length="0" sql="INTEGER" quote=""/>
<type label="TINYINT" length="0" sql="TINYINT" quote=""/>
<type label="SMALLINT" length="0" sql="SMALLINT" quote=""/>
<type label="MEDIUMINT" length="0" sql="MEDIUMINT" quote=""/>
View example_of_many_to_many_in_active_record.rb
require 'active_record'
require 'logger'
ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
ActiveRecord::Base.logger = $stdout
ActiveSupport::LogSubscriber.colorize_logging = false
ActiveRecord::Schema.define do
self.verbose = false
View fcc_map.rb
require 'nokogiri'
require 'rest-client'
require 'erb'
def get_html(url, filename)
one_hour = 1*60*60
stale_time = - one_hour
if File.exist?(filename) && stale_time < File.stat(filename).mtime filename
View Syntax.elm
-- In Ruby we can chain methods:
-- [1,2,3,4,5].map { |n| n * 2 }.reverse.take(3).reduce(0, :+)
-- Do functional languages have syntactic patterns which flow nicely like this?
-- Justin came up with Elm's `|>` operator, which is borrowed from F# and inspired by Unix pipes
-- Li Husan also came up with a good idea for Haskell, but I haven't tried it yet (it's easier to play with Elm)
-- "You can do f = (a . b . c . d) in Haskell, although that's function composition."
View bits.rb
def eq!(a, b)
return true if a == b
message = "#{a.inspect} != #{b.inspect} @ #{caller[0].split(":")[1]}"
raise message
# ===== Basic =====
# List of truth tables and gate symbols @
def nand!(a, b) # Given
a_and_b = a&b
View gilded_rose1.rb
def update_quality(items)
items.each do |item|
if != 'Aged Brie' && != 'Backstage passes to a TAFKAL80ETC concert'
if item.quality > 0
if != 'Sulfuras, Hand of Ragnaros'
item.quality -= 1
if item.quality < 50
View flyer_collage.rb
require 'set'
class Image
def, colour:, w:, h:)
new name, { w, [colour] }
attr_reader :name
def initialize(name, pixels)

You've already written several tests, it's probably worth dropping them in a real test suite and adding some assertions so that it doesn't require interpreting the output. you can prob do the new syntax like ...props so that you can use multiple properties when selecting

The string interpolation on the id is probably not necessary. ie whereTable[ids[i]] probably works. seems to be a select and a map, looks like lodash has a "filter" method for that and a map method

Actually, the map is only necessary b/c you want to work with the values instead of the ids, so ask for them instead of keys htt

View check-chars-iterating-from-beginning-to-middle.js
function palindrome(str) {
str = str.toLowerCase().replace(/[^a-z0-9]/g, "");
for(var i = 0; i < str.length/2; ++i) {
if(str[i] !== str[str.length-i-1]) {
return false;
return true;
Something went wrong with that request. Please try again.