This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gazler@gazler-desktop-pc:~/development/elixir/elixir$ iex | |
Erlang/OTP 17 [erts-6.0] [source-07b8f44] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] | |
Interactive Elixir (0.14.3) - press Ctrl+C to exit (type h() ENTER for help) | |
iex(1)> Regex.split(~r/(%{[^}]+})/, "%{foo}(%{bar}): %{baz}") | |
["", "%{foo}", "(", "%{bar}", "): ", "%{baz}", ""] | |
gazler@gazler-desktop-pc:~/development/elixir/elixir$ iex | |
Erlang/OTP 17 [erts-6.0] [source-07b8f44] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test "Columns with pipes" do | |
result = Earmark.to_html(["a | b | c", "d | e \| f | g"]) | |
expected = """ | |
<table> | |
<colgroup> | |
<col align="left"> | |
<col align="left"> | |
<col align="left"> | |
</colgroup> | |
<tr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Authex.Mixfile do | |
use Mix.Project | |
def project do | |
[app: :authex, | |
version: "0.0.1", | |
elixir: "~> 1.0", | |
deps: deps] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def show | |
case Car.create(conn.assigns.user, params) do | |
{:ok, car} -> | |
conn | |
|> redirect(to: car) | |
{:error, changeset} -> | |
conn | |
|> render("new.html", changeset: changeset) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'date' | |
class Doer | |
attr_accessor :on, :off | |
def makeDate(date) | |
return Date.strptime(date, "%m/%d/%Y") | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SONG_TEMPLATE = ''' | |
<table> | |
{{#if songs.length }} | |
{{#each songs}} | |
<tr><td>{{ this.name }}</td><td>{{ this.duration }}</td></tr> | |
{{/each}} | |
{{/if}} | |
</table> | |
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User | |
@redis = Redis.new | |
def method_missing(m, * args, &block) | |
return @data[m.to_s] if @data.has_key?(m.to_s) | |
super | |
end | |
def initialize(data) | |
@data = data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gazler@gazler-desktop-pc:~/development/pubsub_stress$ WS_CLIENTS=10000 PORT=4000 REMOTE_PORT=4002 MIX_ENV=prod mix phoenix.server | |
#PID<0.253.0>700 subscribers listening on "rooms:lobby" | |
{"Kernel pid terminated",application_controller,"{application_start_failure,pubsub_stress,{{shutdown,{failed_to_start_child,'Elixir.PubsubStress.WebSocketSimulator',{'EXIT',{undef,[{'Elixir.PubsubStress.WebSocketSimulator',start_link,[10000,<<\"4002\">>],[]},{supervisor,do_start_child,2,[{file,\"supervisor.erl\"},{line,314}]},{supervisor,start_children,3,[{file,\"supervisor.erl\"},{line,297}]},{supervisor,init_children,2,[{file,\"supervisor.erl\"},{line,263}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,306}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,237}]}]}}}},{'Elixir.PubsubStress',start,[normal,[]]}}}"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source :rubygems | |
gem "rapidash" | |
gem "activesupport", "~>4.0.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
difficulty 2 | |
description "You need to fix a bug in the version 1.2 of your app. Checkout the tag `v1.2`." | |
setup do | |
repo.init | |
FileUtils.touch("app.rb") | |
repo.add("app.rb") | |
repo.commit_all("Initial commit") |
OlderNewer