Skip to content

Instantly share code, notes, and snippets.

View patrickdet's full-sized avatar

Patrick Detlefsen patrickdet

View GitHub Profile
on:
push:
branches:
- master
jobs:
update-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@0.9.0
sum : Tree Int -> Int
sum tree =
case tree of
Empty -> 0
Node v left right ->
v + sum left + sum right
flatten : Tree a -> List a
flatten tree =
case tree of
@patrickdet
patrickdet / fooserver.ex
Created May 9, 2014 19:18
Elixir XGen GenServer semantics discussion
defmodule FooServer do
@behaviour :gen_server
@server_name {:global, :foo_server}
# Client
def do_it do
try do
:gen_server.call @server_name, :foo
catch
vinz_access [master] ✗ $ mix deps.get && mix test
All dependencies up to date
* Compiling poolboy
==> poolboy (compile)
* Compiling decimal
* Compiling postgrex
* Compiling ecto
Compiled lib/mix/tasks/access.ex
Compiled lib/vinz/access/repo.ex
Compiled lib/vinz/access/models/principal.ex
vinz_access [master] $ mix deps.get && mix test
All dependencies up to date
* Compiling poolboy
==> poolboy (compile)
* Compiling decimal
Compiled lib/decimal.ex
Generated decimal.app
* Compiling postgrex
Compiled lib/postgrex/binary_utils.ex
Compiled lib/postgrex/records.ex

Keybase proof

I hereby claim:

  • I am patrickdet on github.
  • I am patrickdet (https://keybase.io/patrickdet) on keybase.
  • I have a public key whose fingerprint is F49A D070 DFF2 939E 9E45 70FF C1E8 6956 57A3 765C

To claim this, I am signing this object:

class UserSignup
def initialize(params)
@params = params
@success = false
signup
end
def user
@user
end
@patrickdet
patrickdet / id_rsa.pub
Created October 30, 2013 21:11
public ssh key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDW3MQ/9xTFHnicb5hcMr+dbE6w5GHm2iyLtLB87dgI9OVsz+scUymxg434IFPNVdvMiQEt4zDiTY8bPdBAKwGz7A6z2yHWcK97emvZEvJ7IqIyybqbflH4ldzn1+T0czhpeWYGNWtz2MpXFDkdEAHeHm/tkjBnXTdfbqlp6LCXB7KZ8uoWlbRw1Wsx1R6JVsb5TFV2gVGVQ0q0MD+FqOEFUtTG+LcyI1CjMwVdSzvIDUw0AZ7htlE0DMNMU1Q3jQxniyqASOf73MPpXKxXnwXY9rWH6iwsGKQ5MaHXTkVUwmC/ykkn/DAF6HRSJTUBJim5sj4xTLb1vnau9/aH00At
@patrickdet
patrickdet / Prozesse.md
Created March 6, 2012 21:03 — forked from salzig/Prozesse.md
Betriebssysteme

Prozess - das laufende Programm

Programm

Erzeugung

  • unix: fork, execve
  • windows:CreateProcess

Beenden

  • unix: exit / kill
  • windows: ExitProcess / TerminateProcess
@patrickdet
patrickdet / DeviseJsonAdapter.rb
Created January 16, 2012 18:41 — forked from wrs/DeviseJsonAdapter.rb
JSON-encoded error and redirect results for Devise controllers
# JSON-encoded error and redirect results for Devise controllers.
# This overrides an internal method of Devise, so be careful when updating Devise!
#
# Usage:
#
# class Users::RegistrationsController < Devise::RegistrationsController
# include DeviseJsonAdapter
# end
#
# devise_for :users, :controllers => { :registrations => "users/registrations" }