Skip to content

Instantly share code, notes, and snippets.

View jnicklas's full-sized avatar
🏝️
Vacation

Jonas Nicklas jnicklas

🏝️
Vacation
View GitHub Profile
require "capybara"
html = DATA.read
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] }
sess = Capybara::Session.new(:selenium, app)
sess.visit("/")
sess.click_link("Click me")
sess.reset!
source "http://rubygems.org"
ruby "2.3.0"
gem "selenium-webdriver"
gem "capybara", "2.7.0"
# Prevents requests from hitting the Rails app after the test has finished.
class CapybaraRequestBlockerMiddleware
# assignment to initialized instance variables is thread safe in Ruby
@enabled = false
class << self
def enabled?
@enabled
end
Compiling graphers v0.1.0 (file:///Users/jonasnicklas/Projects/graphers)
src/parse/grammar.rs:390:13: 390:60 error: unreachable pattern [E0001]
src/parse/grammar.rs:390 Some((__loc1, Tok::Identifier(__tok0), __loc2)) => {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/parse/grammar.rs:390:13: 390:60 help: run `rustc --explain E0001` to see a detailed explanation
src/parse/grammar.rs:438:13: 438:60 error: unreachable pattern [E0001]
src/parse/grammar.rs:438 Some((__loc1, Tok::Identifier(__tok0), __loc2)) => {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/parse/grammar.rs:438:13: 438:60 help: run `rustc --explain E0001` to see a detailed explanation
src/parse/grammar.rs:481:13: 481:45 error: unreachable pattern [E0001]
<!doctype html>
<html>
<body>
<ul>
</ul>
<script>
(function() {
var a = 10, b = 20;
@jnicklas
jnicklas / test.md
Last active December 7, 2015 13:24

| hello | world | | ----- + ------| | Fooo | Bar |

@jnicklas
jnicklas / post.md
Last active October 14, 2015 20:30
Why do .env files exist?

Why do .env files exist?

Lately I've seen a lot of projects use .env files to store application configuration, files which look something like this:

FOO=bar
Bar=baz
class Underscore < BasicObject
def initialize(invocations = [])
@invocations = invocations
end
def to_proc
invocations = @invocations
::Kernel.lambda do |val|
invocations.reduce(val) do |val, (name, args, block)|
val.send(name, *args, &block)
require 'benchmark/ips'
require 'memoit'
class Tested
def manual
@manual ||= 123
end
def manual_hash(key)
@manual_hash ||= {}
standard_error.rs:14:28: 14:35 error: cannot infer an appropriate lifetime for pattern due to conflicting requirements
standard_error.rs:14 StandardErrorWrapped(ref err) => err.description()
^~~~~~~
standard_error.rs:14:40: 14:43 note: first, the lifetime cannot outlive the expression at 14:39...
standard_error.rs:14 StandardErrorWrapped(ref err) => err.description()
^~~
standard_error.rs:14:40: 14:43 note: ...so that pointer is not dereferenced outside its lifetime
standard_error.rs:14 StandardErrorWrapped(ref err) => err.description()
^~~
standard_error.rs:12:5: 15:6 note: but, the lifetime must be valid for the match at 12:4...