Skip to content

Instantly share code, notes, and snippets.

View jfreeze's full-sized avatar

Jim Freeze jfreeze

View GitHub Profile
@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 April 2, 2024 08:15
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
@jfreeze
jfreeze / app.js
Created May 15, 2013 12:56
Adjust ember-data url to add .json
http://stackoverflow.com/questions/14828478/ember-js-ember-data-restadapter-fail-to-load-json
// TravelClient.CUSTOMAdapter = DS.RESTAdapter.extend({
bulkCommit: false,
url: "http://remote_server_address",
buildURL: function(record, suffix) {
var s = this._super(record, suffix);
return s + ".json";
}
})