View chain.ex
1 2 3 4 5 6 7 8 9 10
defmodule Chain do
def counter(next_pid) do
receive do
n ->
send next_pid, n + 1
end
end
 
def create_processes(n) do
last = Enum.reduce 1..n, self,
View gist:6bbae64b2afe1f32441e
1 2 3 4 5
** (UndefinedFunctionError) undefined function: :xmlElement.name/1 (module :xmlElement is not available)
:xmlElement.name({:xmlElement, :credit, :credit, [], {:xmlNamespace, [], [{'xsd', :"http://www.w3.org/2001/XMLSchema"}, {'xsi', :"http://www.w3.org/2001/XMLSchema-instance"}]}, [current_observation: 2], 2, [], [{:xmlText, [credit: 2, current_observati
on: 2], 1, [], 'NOAA\'s National Weather Service', :text}], [], '/Users/bcardarella/Dropbox/projects/elixir/issues', :undeclared})
(issues) lib/issues/weather.ex:15: anonymous fn/2 in Weather.parse_nodes/1
(elixir) lib/enum.ex:1261: Enum."-reduce/3-lists^foldl/2-0-"/3
View weather.ex
1 2 3 4 5 6 7 8 9 10
defmodule Weather do
require Record
Record.defrecord :xmlElement, Record.extract(:xmlElement, from_lib: "xmerl/include/xmerl.hrl")
Record.defrecord :xmlText, Record.extract(:xmlText, from_lib: "xmerl/include/xmerl.hrl")
 
def parse_url(url) do
{:ok, response} = HTTPoison.get(url)
{ xml, _rest} = :xmerl_scan.string :erlang.bitstring_to_list(response.body)
nodes = :xmerl_xpath.string('/current_observation/*', xml)
{ response, xml, nodes }
View gist:9e7ad1f4d23e0c16accf
1 2
|> Enum.map &_normalize(&1)
|> Enum.sort(&(String.length(&2) <= String.length(&1)))
View method.rb
1 2 3 4 5 6 7 8 9 10
# Ruby Challenge
#
# Access the original method signature of a class's
# instance method after a module has been prepended
# into that class
 
require 'minitest/autorun'
 
module A
def foo
View book.md
  1. Setting up Development Environment
    1. Installing Node.js
    2. Intalling Ember-CLI
    3. Installing PhantomJS
    4. Confirmation of Installation
      1. Generate a project
      2. Run web server & visit page
  2. Introduction to Ember-CLI
    1. Overview of project structure
      1. app/
View gist:7a8cee6b86bd7dd5c54d
1 2 3 4 5 6 7 8 9 10
# Remap prefix to C-a
set -g prefix C-a
unbind C-b
 
#shorten escape time
set -sg escape-time 1
 
# Use 1-based indexes
set -g base-index 1
setw -g pane-base-index 1
View gist:8a0ff3e56881324b7c74
1 2 3 4 5 6 7 8 9 10
{
"productSegments": [
{
"id": 1,
"segment": "AB"
}
],
"projects": [
{
"id": 1,
View gist:cf5c14311af42e38d932
1 2 3 4 5 6 7 8 9
requirejs.rollback = function() {
for(var entry in this.previousEntries) {
if (this.previousEntries[entry]) {
registry[entry] = this.previousEntries[entry];
} else {
delete registry[entry];
}
}
};
View syntax-1.rb
1 2 3 4 5 6 7 8 9 10
table :owners do
row :brian do
name 'Brian'
age 35
end
end
 
table :dogs do
row :boomer do
name 'Boomer'
Something went wrong with that request. Please try again.