Skip to content

Instantly share code, notes, and snippets.

@bottlenecked
bottlenecked / settings.json
Created May 23, 2019 19:51
Visual Studio Code settings for coloring additional Elixir-specific symbols (from my dark theme, but one can always experiment with the colors)
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"name": "atoms and such",
"scope": "constant.other.symbol.elixir",
"settings": {
"foreground": "#489CC8"
}
},
{
-module(connection).
-behaviour(gen_statem).
-export([start_link/1, request/2]).
-export([callback_mode/0, init/1]).
-export([disconnected/3, connected/3]).
%% Public API.
start_link(Opts) ->
/*
FastLED Fire 2018 by Stefan Petrick
The visual effect highly depends on the framerate.
In the Youtube video it runs at arround 70 fps.
https://www.youtube.com/watch?v=SWMu-a9pbyk
The heatmap movement is independend from the framerate.
The actual scaling operation is not.
@Qqwy
Qqwy / elixir_operator_info.exs
Created July 7, 2016 20:01
Elixir Operator Info
# See https://github.com/elixir-lang/elixir/blob/master/lib/elixir/src/elixir_parser.yrl#L52
# for the list of operators with associativity, etc.
# The operators in this list are grouped by precedence, low to high.
# The comments indicate the operator's normal function, as well as its ability to be defined/overridden.
-> # CompileError 'unhandled operator'. only allowed in anonymous function syntax.
& # CompileError, only allowed in short anonymous function syntax.
@tadast
tadast / ssl_puma.sh
Last active January 29, 2024 04:41 — forked from trcarden/gist:3295935
localhost SSL with puma
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@nabucosound
nabucosound / heroku_env_copy.sh
Created December 30, 2013 12:40
Script to copy environment variables from an existing heroku app to another one
#!/bin/bash
# Source: http://blog.nonuby.com/blog/2012/07/05/copying-env-vars-from-one-heroku-app-to-another/
set -e
sourceApp="$1"
targetApp="$2"
while read key value; do
@meh
meh / lol.exs
Created December 16, 2013 17:29
defmodule Fun do
def arity(fun) do
case :erlang.fun_info(fun, :arity) do
{ :arity, arity } ->
arity
end
end
def adapt!(fun, 0) do
fn -> fun.([]) end
@johnantoni
johnantoni / raskel.rb
Created October 4, 2012 16:20
raskel in ruby
$stack, $draws = [], {}
def method_missing *args
return if args[0][/^to_/]
$stack << args.map { |a| a or $stack.pop }
$draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :<
end
class Array
def +@