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 = Rack::Lobster.new
server = TCPServer.new 5678
while session = server.accept
request = session.gets
puts request
@jeffkreeftmeijer
jeffkreeftmeijer / README.md
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 https://github.com/jeffkreeftmeijer/enough.css
View README.md
View frame.html
<html>
<head>
<style>
body{
margin: 0;
}
div{
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 Terminal.app, 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
jeffkreeftmeijer / README.textile
Created Nov 14, 2010
A stupid RSpec formatter that prints FFFUUU instead of FFFFF. Heh.
View README.textile

FffuuuFormatter

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

Installation

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

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

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'
end
end
end
You can’t perform that action at this time.