Skip to content

Instantly share code, notes, and snippets.

Jeff Kreeftmeijer jeffkreeftmeijer

Block or report user

Report or block jeffkreeftmeijer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View http_server.rb
require 'socket'
require 'rack'
require 'rack/lobster'
app =
server = 5678
while session = server.accept
request = session.gets
puts request
jeffkreeftmeijer /
Last active Jan 30, 2019
enough.css is a tiny CSS style sheet with most of the styling you'll need for that blog of yours. It moved to
View frame.html
margin: 0;
padding: 10px 10px 10px 10px;
View ansi_colors.adoc

Terminal colors with ANSI escape sequences

Terminal emulators use ANSI escape sequences to --amongst other things like controlling the cursor’s position-- read the desired text and background color when printing output.

$ echo -e "\033[31mred\033[m" # Prints "red" in red.

While most terminal emulators, including Apple’s, support true color now, most utilities use one of the main sixteen colors (black, red, green, yellow, blue, magenta, cyan, white, and a high intensity or bright version of each). For example, git shows diffs with additions in green and deletions in red, and most testing frameworks print green dots and red "F"s for failures.

jeffkreeftmeijer / README.textile
Created Nov 14, 2010
A stupid RSpec formatter that prints FFFUUU instead of FFFFF. Heh.
View README.textile


A stupid RSpec formatter that prints FFFUUU instead of FFFFF. Heh.


Throw it in a file and run your specs like this:

$ rspec -r path/to/fffuuu_formatter.rb -f FffuuuFormatter spec/

Rails with mssql on macOS

Start mssql in docker

docker pull microsoft/mssql-server-linux:2017-latest
docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=B4n44n123' -p 1401:1433 --name sql1 -d microsoft/mssql-server-linux:2017-latest
docker ps -a
View pirate_validator.rb
class PirateValidator < ActiveModel::Validator
def validate(document)
unless document.comment.include? 'matey'
document.errors[:comment] << 'does not sound like a pirate'
You can’t perform that action at this time.