This file contains hidden or 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 UeberTest.AuthController do | |
| use UeberTest.Web, :controller | |
| plug Ueberauth | |
| alias Ueberauth.Strategy.Helpers | |
| def request(conn, _params) do | |
| render(conn, "request.html", callback_url: Helpers.callback_url(conn)) | |
| end | |
| def callback(%{assigns: %{ueberauth_failure: _fails}} = conn, _params) do |
This file contains hidden or 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 compare(conn, params) do | |
| first = params["code"]["first_snippet"] | |
| second = params["code"]["second_snippet"] | |
| code = """ | |
| defmodule Sample do | |
| def benchee do | |
| Benchee.init(%{time: 3}) | |
| |> Benchee.benchmark('first snippet', fn -> #{first} end) | |
| |> Benchee.benchmark('second snippet', fn -> #{second} end) |
This file contains hidden or 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 compare(conn, params) do | |
| first = params["code"]["first_snippet"] | |
| second = params["code"]["second_snippet"] | |
| {val, _} = Code.eval_string("Benchee.init(%{time: 3}) | |
| |> Benchee.benchmark('First', fn -> #{first} end) | |
| |> Benchee.benchmark('Second', fn -> #{second} end) | |
| |> Benchee.measure | |
| |> Benchee.statistics | |
| |> BencheeWeb.Formatter.to_map") |
This file contains hidden or 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 MyMacros do | |
| defmacro benchee(suite, name, function) do | |
| quote do | |
| benchee.benchmark(unquote(suite), unquote(name), unquote(function)) | |
| end | |
| end | |
| end |
This file contains hidden or 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
| var sql = new Sql().Append("declare @@result int") | |
| .Append("exec GetData @userId, @date", | |
| new {userId = userId, @date = DateTime.Now}) | |
| .Append("select @@result); | |
| var ret = Database.ExecuteScalar<int>(sql); |
This file contains hidden or 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
| Path.join("#{:code.priv_dir(:random_tweets)}", filename) | |
| |> RandomTweets.File.get_line | |
| |> ExTwitter.update | |
This file contains hidden or 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 get_line(path) do | |
| path | |
| |> File.read! | |
| |> String.split(~r{\n}) | |
| |> Enum.map(&String.strip/1) | |
| |> Enum.filter(fn x -> String.length(x) <= 140 end) | |
| |> Enum.random | |
| end |
This file contains hidden or 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
| using UnsignedInteger = System.UInt16; // Sorry, I can't unabbreviate it on the RHS | |
| // https://twitter.com/taylonr/status/712277308363542530 | |
| namespace FizzBuzz | |
| { | |
| class Program | |
| { | |
| static void Main(System.String[] args) | |
| { |
This file contains hidden or 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
| { | |
| "_id": "Tournament", | |
| "Name": "Tournament", | |
| "Records": [ | |
| { | |
| "_id": "0329201309:57:17.231", | |
| "Date": { | |
| "$date": "2013-03-23T14:55:25.856Z" | |
| }, | |
| "Note": "0-2 Gi & 0-2 NoGi at Sasquatch Open" |
This file contains hidden or 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
| public class User | |
| { | |
| public string Email {get; set;} | |
| public string FirstName {get; set;} | |
| public string LastName {get; set;} | |
| public string Password {get; set;} | |
| } | |
| public class UserLogic | |
| { |
NewerOlder