Skip to content

Instantly share code, notes, and snippets.

View jfreeze's full-sized avatar

Jim Freeze jfreeze

View GitHub Profile
@jfreeze
jfreeze / gist:9174964
Created February 23, 2014 18:09
Github-backup Compile Problems
$ make
if [ "cabal " = ./Setup ]; then ghc --make Setup; fi
cabal configure
Resolving dependencies...
[ 1 of 20] Compiling Utility.Env ( Utility/Env.hs, dist/setup/Utility/Env.o )
[ 2 of 20] Compiling Utility.UserInfo ( Utility/UserInfo.hs, dist/setup/Utility/UserInfo.o )
[ 3 of 20] Compiling Utility.PartialPrelude ( Utility/PartialPrelude.hs, dist/setup/Utility/PartialPrelude.o )
[ 4 of 20] Compiling Utility.FileSystemEncoding ( Utility/FileSystemEncoding.hs, dist/setup/Utility/FileSystemEncoding.o )
[ 5 of 20] Compiling Utility.Applicative ( Utility/Applicative.hs, dist/setup/Utility/Applicative.o )
[ 6 of 20] Compiling Utility.Data ( Utility/Data.hs, dist/setup/Utility/Data.o )
@jfreeze
jfreeze / gist:9076669
Created February 18, 2014 18:22
N2O and Elixir
ims-MacBook-Pro-3:n2o_elixir jimfreeze$ mix run --ho-halt
Compiled lib/sample/sup.ex
Compiled lib/sample/routes.ex
Compiled lib/sample.ex
Compiled lib/sample/index.ex
== Compilation error on file lib/sample/n2o.ex ==
** (RuntimeError) error parsing file /Users/jimfreeze/Documents/Projects/N2O/n2o_elixir/_build/dev/lib/cowboy/src/cowboy_req.erl, got: {:error, :enoent}
(elixir) lib/record/extractor.ex:55: Record.Extractor.read_file/1
(elixir) lib/record/extractor.ex:33: Record.Extractor.retrieve_record/2
lib/sample/n2o.ex:11: (module)
@jfreeze
jfreeze / gist:8894279
Last active August 1, 2024 17:34
Get VI bindings in IEX (Elixir REPL)
# VI bindings in iex:
brew install rlwrap # on OSX
echo "alias iex='rlwrap -a foo iex'" >> ~/.bash_profile
echo "set editing-mode vi" >> ~/.inputrc
source ~/.bash_profile
# To run iex WITHOUT rlwrap
\iex
@jfreeze
jfreeze / gist:8873327
Created February 7, 2014 22:28
Doc issue Elixir 0.12.2
mix new doctest
cd doctest
Add the following to mix.exs
{ :ex_doc, github: "elixir-lang/ex_doc", ref: "f9c1d88acf8211f41c786750d47e9459b885241f" }
mix deps.get
* Getting ex_doc (git://github.com/elixir-lang/ex_doc.git)
Cloning into '/Users/jimfreeze/Documents/Projects/PlugnPay/doctest/deps/ex_doc'...
remote: Reusing existing pack: 2286, done.
$ find _build/
_build/
_build//shared
_build//shared/lib
_build//shared/lib/curl
_build//shared/lib/curl/.compile.elixir
_build//shared/lib/curl/.compile.lock
_build//shared/lib/curl/ebin
_build//shared/lib/curl/ebin/curl.app
_build//shared/lib/curl/ebin/Elixir.Curl.beam
@jfreeze
jfreeze / gist:8868387
Created February 7, 2014 18:11
mix.exs for mix docs
defmodule Curl.Mixfile do
use Mix.Project
def project do
[ app: :curl,
version: "0.0.1",
elixir: "~> 0.12.2",
name: "Curl",
source_url: "http:localhost:4000", deps: deps ]
end
@jfreeze
jfreeze / gist:8845632
Created February 6, 2014 14:52
URI.decode
iex(40)> URI.decode("% fred")
** (FunctionClauseError) no function clause matching in URI.hex2dec/1
(elixir) lib/uri.ex:188: URI.hex2dec(32)
(elixir) lib/uri.ex:179: URI.decode/1
@jfreeze
jfreeze / gist:8789534
Last active August 29, 2015 13:55
Dynamo mix.exs
#### DYNAMO MIX FILE ##### DYNAMO Project Mix File Below
defmodule Dynamo.Mixfile do
use Mix.Project
def project do
[ app: :dynamo,
elixir: "~> 0.12.0",
version: "0.1.0-dev",
name: "Dynamo",
source_url: "https://github.com/elixir-lang/dynamo",
iex(3)> s2=File.stream!("APP_FL.uncompressed.pdf")
#Function<17.133702391 in Stream.resource/3>
iex(4)> Enum.map(s2, fn line -> IO.puts line end )
%PDF-1.5
** (ArgumentError) argument error
:io.put_chars(#PID<0.25.0>, :unicode, [<<37, 226, 227, 207, 211, 10>>, 10])
/Users/jimfreeze/.kiex/builds/elixir-git/lib/elixir/lib/enum.ex:885: Enum."-map/2-fun-0-"/3
/Users/jimfreeze/.kiex/builds/elixir-git/lib/elixir/lib/stream.ex:923: Stream.do_resource/5
/Users/jimfreeze/.kiex/builds/elixir-git/lib/elixir/lib/stream.ex:934: Stream.do_resource/5
@jfreeze
jfreeze / gist:8602632
Created January 24, 2014 18:01
PDF Download Headers
Sinatra
Connection:keep-alive
Content-Disposition:attachment; filename='quote.pdf'
Content-Length:114372
content-type:application/pdf; charset=utf-8
Server:thin 1.6.1 codename Death Proof
X-Content-Type-Options:nosniff