Skip to content

Instantly share code, notes, and snippets.

View Jell's full-sized avatar

Jean-Louis Giordano Jell

View GitHub Profile
@Jell
Jell / timetravel.rb
Created November 15, 2020 11:02
Fun with callcc
require "continuation"
class Hash
alias_method :_original_lookup, :[]
def [](key)
_original_lookup(key).tap do
callcc { |cc| $hash_cc = [cc]; nil }&.tap do |value_from_future|
self[key] = value_from_future
$hash_cc.pop.call(self)
module Test
import TestProvider
%default total
%language TypeProviders
add : Int -> Int -> Int
add x y = 0
%provide (result : String) with compileTest [
{-# LANGUAGE Rank2Types #-}
import Control.Lens hiding (element)
import Data.Text as T (splitOn
, concat
, Text
, pack
, toTitle
, toLower)
twiceLens :: String -> Iso' Text (String, Text)
@Jell
Jell / Assignment.md
Last active November 25, 2019 15:53

Programming Assignment

Write a script/program that reads a sequence of mathematical expressions from a file and prints the result of evaluating all expressions in the order they appear.

The file consists of a series of expressions, one per line.

Each line is in the format function <value>. ADD 5, for example, adds 5 to the current value. The initial value when the program starts is 0. A file contains maximum ten rows.

The following functions shall be supported:

@Jell
Jell / dinghy-connect.sh
Last active August 17, 2017 15:00
Recipe for SSH forwarding with dinghy (https://github.com/codekitchen/dinghy)
function dinghy-connect {
# Make sure SSH agent is running
ssh-add -K
# Make sure dinghy is up and running
dinghy create 2> /dev/null || echo "dinghy VM already created"
dinghy up 2> /dev/null || echo "dinghy VM already running"
# Check if SSH forwarding is already in place
DINGHY_SSH_SOCK=$(dinghy ssh find -type f /tmp/ssh-*/agent.* 2> /dev/null || echo "missing")
@Jell
Jell / cljs.test.repl.clj
Created August 30, 2016 17:37
CLJS run single test var
(ns cljs.test.repl
(:require [cljs.analyzer.api :as ana-api]
[cljs.analyzer :as ana]
[cljs.test]))
(defmacro run-single-test [[quote var :as form]]
(let [ns (or (some-> var namespace symbol)
ana/*cljs-ns*)]
`(cljs.test/run-block
(concat

Definitely:

  • craft conf, Budapest (April 22-24) Many clojure and ICFP people
  • code mesh, London (November 2-4)

Maybe:

  • polyconf, POZnan (Poland) (July 2-4)
@Jell
Jell / fizzbuzz_constants.rb
Last active August 29, 2015 14:07
FizzBuzz qualified constants
require 'active_support/core_ext'
module T
module T
module T
def self.zero; end
end
end
end
@Jell
Jell / immutable_record.rb
Last active August 29, 2015 14:07
Immutable Record
## DEFINITION ##
# Compact version, with just a hint of meta-programming
Item = ImmutableRecord.new(:foo, :bar)
# Strict Equivalent, without meta-programming:
class ItemBis < ImmutableRecord::Value
def self.attributes
[:foo, :bar]
end

Keybase proof

I hereby claim:

  • I am Jell on github.
  • I am jell (https://keybase.io/jell) on keybase.
  • I have a public key whose fingerprint is 4FC1 6BA1 7B0D CB89 9AA9 CDEE 6F59 07B1 521F CF64

To claim this, I am signing this object: