I hereby claim:
- I am alco on github.
- I am alco (https://keybase.io/alco) on keybase.
- I have a public key whose fingerprint is 4C14 8955 BB20 D94E 2483 4392 E5B2 32A7 2D91 58F1
To claim this, I am signing this object:
// simple fragment shader | |
// 'time' contains seconds since the program was linked. | |
uniform float time; | |
uniform sampler2D tex; | |
uniform sampler2D tex2; | |
float radius = .5; |
def open_port(executable, args) do | |
Port.open({:spawn_executable, executable}, [:stream, :binary, {:args, args}, :use_stdio, :stderr_to_stdout, :exit_status]) | |
end | |
def process_port(port) do | |
case collect_output(InternalData[port: port], []) do | |
{status, data} -> Result[status: status, output: to_string(data)] | |
end | |
end |
git ls-files | egrep '\.erl|\.ex[s]$' | xargs cat | sed '/^$/d' | wc -l |
defmodule View do | |
defrecord Page, [templates: []] | |
defmacro __using__(_) do | |
template = """ | |
<%= for template <- page.templates do %> | |
<%= template.id %> :: | |
<% end %> | |
<%= if true do %> |
iex(8)> Regex.run %r/^~(\d)+\.\.[0 ]B$/, "~4..0B" | |
["~4..0B", "4"] | |
iex(9)> Regex.run %r/^~(\d)+\.\.[0 ]B$/, "~4..0B", capture: :groups | |
** (ArgumentError) regex was not compiled with g | |
/Users/alco/Documents/git/elixir/lib/elixir/lib/regex.ex:134: Regex.run/3 | |
erl_eval.erl:569: :erl_eval.do_apply/6 | |
src/elixir.erl:138: :elixir.eval_forms/3 | |
iex(9)> Regex.run %r/^~(\d)+\.\.[0 ]B$/g, "~4..0B", capture: :groups | |
[] |
defmodule L do | |
# lc x inlist [0, 1], y inlist [:a, :b], do: {x, y} | |
defmacro do_list(list) do | |
args = 1..length(list) | |
|> Enum.map(fn x -> binary_to_atom(<<?a + x :: utf8>>) end) | |
|> Enum.map(fn x -> {x, [], :Elixir} end) # this creates AST nodes for variables | |
pairs = Enum.zip(args, list) | |
|> Enum.map(fn {v, lst} -> | |
quote do |
iex> use PipeInspect | |
nil | |
iex> "hello" |> String.reverse |> String.upcase |> String.downcase | |
"olleh" | |
"OLLEH" | |
"olleh" |
defmodule TimeFormat do | |
def format(seconds) do | |
hours = div(seconds, 3600) | |
remainder = rem(seconds, 3600) | |
minutes = div(remainder, 60) | |
seconds = rem(remainder, 60) | |
format(hours, minutes, seconds) | |
end | |
defp format(0, minutes, seconds), do: "#{minutes}:#{pad(seconds)}" |
I hereby claim:
To claim this, I am signing this object:
#include <string> | |
#include "regex.h" | |
/* | |
* Return a new string with all occurrences of 'from' replaced with 'to' | |
*/ | |
std::string replace_all(const std::string &str, const char *from, const char *to) | |
{ | |
std::string result(str); |