Skip to content

Instantly share code, notes, and snippets.

View jnicklas's full-sized avatar

Jonas Nicklas jnicklas

View GitHub Profile
jnicklas / graphql-codegen-yup-schema.js
Created February 11, 2022 09:42
A plugin for GraphQL Codegen which generates yup schemas
// A custom plugin for graphql-codegen, which generate `yup` schemas for input objects
// Loosely based on
module.exports = {
plugin: schema => {
function buildObject(node) {
let fieldsResult = => {
return ` ${fieldResult}`;
return `yup.object().shape({\n${fieldsResult}\n});`
jnicklas / konami.ts
Created April 20, 2021 08:20 — forked from cowboyd/konami.ts
Konami Code detector written in effection
import { run } from 'effection';
import { once } from '@effection/events';
run(function*() {
yield konamiCodeEntered();
alert('99 lives!');
function * konamiCodeEntered() {
while (true) {
class Client
attr_reader :key,
def initialize(key)
@key = key
end"moo") # results in: ArgumentError: wrong number of arguments (given 1, expected 0)
  • Feature Name: throwing_functions
  • Start Date: 2017-06-20
  • RFC PR: (leave this empty)
  • Rust Issue: (leave this empty)


Add an annotation to functions that they may "throw" an error type, which changes the function's return type to Result where T is the functions return type and E is the function's

const vm = require('vm');
const repl = require('repl');
function myEval(cmd, context, filename, callback) {
let result;
try {
result = vm.runInContext(cmd, context);
} catch (e) {
return callback(e);
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
gemfile(true) do
source ""
gem "rails", github: "rails/rails"
describe "My page" do
it "lists the item" do
item = create_item
within item_row(item) do
expect(page).to mention_item(item)
require "capybara"
html =
app = proc { |env| [200, { "Content-Type" => "text/html" }, [html] ] }
sess =, app)
sess.click_link("Click me")
source ""
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?