Skip to content

Instantly share code, notes, and snippets.

View paulcsmith's full-sized avatar

Paul Smith paulcsmith

View GitHub Profile
@paulcsmith
paulcsmith / hello world benchmark
Last active December 4, 2017 13:28
Lucky hello world benchmark 0.6.1
% wrk -t4 -c100 -d30S --timeout 2000 http://localhost:8080
Running 30s test @ http://localhost:8080
4 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 1.89ms 481.91us 14.54ms 93.89%
Req/Sec 13.41k 1.90k 14.70k 90.08%
1601002 requests in 30.00s, 299.26MB read
Requests/sec: 53358.67
Transfer/sec: 9.97MB
@paulcsmith
paulcsmith / app_conn.cr
Last active November 21, 2017 21:16
Testing Lucky apps
# spec/support/app_conn.cr
require "http/client"
class AppConn
getter! response
@response : HTTP::Client::Response? = nil
module Matchers
def contain_html(html : String)
ContainHtmlExpectation.new(html)
@edwardloveall
edwardloveall / thoughts.md
Created October 30, 2017 00:39
Lucky thoughts
web v0.4.2
migrator: v0.2.3

Routing is a little odd at first, but I think I will enjoy it eventually. It's weird having implicit routes.

I love having the routes in pages be their own classes, i.e. link "Edit", to: Topics::Edit.route(topic). The relationship between routes and controller#action is a part of rails that I think a lot of beginners don't grok for a while.

My mental model for what goes in a form, query, and model is pretty confused. I love the idea of separation. It's one of the first parts of rails to get messy, but I need a lot of help understanding where to put what. This could very well be me having to unlearn rails.

#!/usr/bin/env ruby
require 'base64'
require 'nokogiri'
require 'uri'
def main
html = Nokogiri::HTML($stdin.read)
inline_all_images(html)
inline_all_css(html)
@cjgajard
cjgajard / app.cr
Last active September 12, 2019 08:20
Kemal controllers pattern
# src/{{app_name}}.cr
require "kemal"
require "./controllers/*"
alias Env = HTTP::Server::Context # this could be provided by Kemal
module Main
get "/", &->index(Env)
get "/:name", &->greet(Env)
end
@searls
searls / market_research.rb
Last active September 18, 2018 03:21
Was chatting with @mfeathers about retaining Ruby's chained Enumerable style, but finding a way to inject names that reflects the application domain (as opposed to just littering functional operations everywhere, which may be seen as a sort of Primitive Obsession)
# A little toy file demonstrating how to build chainable
# data transformations that reveal some amount of intent
# through named extracted methods.
#
# Kudos to @mfeathers for giving me the idea to try this
#
# Copyright Test Double, LLC, 2016. All Rights Reserved.
require_relative "marketing_refinements"
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
diff --git a/brunch-config.js b/brunch-config.js
deleted file mode 100644
index 28a5d35..0000000
--- a/brunch-config.js
+++ /dev/null
@@ -1,58 +0,0 @@
-exports.config = {
- // See http://brunch.io/#documentation for docs.
- files: {
- javascripts: {

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.