Skip to content

Instantly share code, notes, and snippets.

@P-Seebauer
P-Seebauer / argon2_test.ex
Created April 4, 2018 23:08
problem with dialyzer
defmodule Argon2Test do
@hash_for_foo "$argon2i$v=19$m=65536,t=6,p=1$dxSBP76R4icBDzu06CJRBQ$q4v8CePvqsdbSNBjBS0RRibryQI3Xo6ahYSqUZbdNaI"
@spec test_pass(String.t) :: (:failed | {:ok, map()})
def test_pass(pass) do
db_user = %{password_hash: @hash_for_foo}
with {:ok, ^db_user} <- Comeonin.Argon2.check_pass(db_user, pass) do
{:ok, db_user}
else
v8.9.1
5.6.0
/home/pat/Scripts/js/nyc-bug
└─┬ nyc@11.6.0
├── archy@1.0.0
├── arrify@1.0.1
├─┬ caching-transform@1.0.1
│ ├── md5-hex@1.3.0 deduped
│ ├── mkdirp@0.5.1 deduped
│ └─┬ write-file-atomic@1.3.4
# possible solution for http://rosettacode.org/wiki/Amb
my @a =
(all «the that a»),
(all «frog elephant thing»),
(all «walked treaded grows»),
(all «slowly quickly»);
sub test (Str $l, Str $r) {
$l.ends-with($r.substr(0,1))
@P-Seebauer
P-Seebauer / elixir.exs
Last active September 24, 2015 21:12
coin counter
h=100
IO.puts(([200,h,50,20,10,5,2,1]|>Enum.reduce{h*elem(Float.parse(hd System.argv),0)|>trunc,[]},fn(i,{c,l})->{rem(c,i),List.duplicate(i<h&&"#{i}¢ "||"#{div(i,h)}€ ",div(c,i))++l}end)|>elem 1)
@P-Seebauer
P-Seebauer / gist:904b66d4ef9fca51d207
Created December 4, 2014 12:25
fluendo checking for method existence
# somewhere
extendMaybe = (classObjs...) ->
for classObj in classObjs
(methodName, method) -> classObj::[methodName] = method unless classObj::[methodName]?
# top of your file:
[extend] = extendMaybe String
# usage:
extend "append", (stringToAppend)-> @ + if stringToAppend then stringToAppend else ''
@P-Seebauer
P-Seebauer / .gitignore
Last active August 29, 2015 14:06 — forked from octocat/.gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@P-Seebauer
P-Seebauer / TEMPLATE.glsl
Created May 22, 2014 04:00 — forked from glslioadmin/TEMPLATE.glsl
GLSL.io Transition (v1)
#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D from, to;
uniform float progress;
uniform vec2 resolution;
float f(float p, float x,float y){
float a = x<.5 ?
x<.25? 2. :
@P-Seebauer
P-Seebauer / TEMPLATE.glsl
Created May 21, 2014 12:23 — forked from glslioadmin/TEMPLATE.glsl
GLSL.io Transition (v1)
#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D from, to;
uniform float progress;
uniform vec2 resolution;
uniform vec3 r; // ( left/right,top/bottom, radius)
bool isBlack(float progress, vec2 p){
@P-Seebauer
P-Seebauer / colourDistance.glsl
Created May 21, 2014 07:10 — forked from glslioadmin/TEMPLATE.glsl
GLSL.io Transition (v1)
#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D from, to;
uniform float progress;
uniform vec2 resolution;
// default interpolationPower = 5;
uniform float interpolationPower;
% Hey, I gave the things you did a little thought.
% But altered almost everything, that's why I don't think it's an sufficient answer anylonger so I made a gist.
% Firstof: I removed all your string construction with format and use one atom_codes
% (btw there is a string type in SWI-Prolog for efficient string handling).
% Next, I thought it should be part of the predicate if you end with a newline or had reached the end of file.
% After that, I put some neat little tricks in there to get backtracking behaviour for the get_line/3 - predicate.
% I hope this helps you in any way.