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 cache = []; | |
| model.latest = function() { | |
| makeRequest().then(replace); // If I put this on the function below, the tests still pass | |
| return function() { // but when using mithril, I would get infinite requests | |
| return cache; | |
| }; | |
| }; | |
| function makeRequest() { |
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 m = require('mithril'), | |
| NavBar = require("fw7/nav-bar"); | |
| function controller(args) { | |
| scope = {}; | |
| var popupEl = document.getElementById('popup'); | |
| scope.open = function() { | |
| m.render(popupEl, [ | |
| m.component(NavBar, {back: fw7.closeModal}), |
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
| /Users/Papipo/.rvm/gems/ruby-2.2.3/gems/cupertino-1.3.4/lib/cupertino/provisioning_portal/agent.rb:188:in `list_profiles': Cupertino::ProvisioningPortal::UnexpectedContentError (Cupertino::ProvisioningPortal::UnexpectedContentError) | |
| from /Users/Papipo/.rvm/gems/ruby-2.2.3/gems/cupertino-1.3.4/lib/cupertino/provisioning_portal/commands/profiles.rb:9:in `block (3 levels) in <top (required)>' | |
| from /Users/Papipo/.rvm/gems/ruby-2.2.3/gems/cupertino-1.3.4/lib/cupertino/provisioning_portal/helpers.rb:58:in `try' | |
| from /Users/Papipo/.rvm/gems/ruby-2.2.3/gems/cupertino-1.3.4/lib/cupertino/provisioning_portal/commands/profiles.rb:9:in `block (2 levels) in <top (required)>' | |
| from /Users/Papipo/.rvm/gems/ruby-2.2.3/gems/commander-4.3.5/lib/commander/command.rb:178:in `call' | |
| from /Users/Papipo/.rvm/gems/ruby-2.2.3/gems/commander-4.3.5/lib/commander/command.rb:178:in `call' | |
| from /Users/Papipo/.rvm/gems/ruby-2.2.3/gems/commander-4.3.5/lib/commander/command.rb:153:in `run' | |
| from /Users/Papipo/.rvm/gems/ruby-2.2.3/gems/co |
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
| /* | |
| * build.js | |
| */ | |
| var browserify = require('browserify'), | |
| watchify = require('watchify'), | |
| Q = require('q'), | |
| path = require('path'), | |
| fs = require('fs-extra'), | |
| chokidar = require('chokidar'), |
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 m = require("mithril"); | |
| function pullToRefreshLayer() { | |
| return m(".pull-to-refresh-layer", [ | |
| m(".preloader"), | |
| m(".pull-to-refresh-arrow") | |
| ]); | |
| } | |
| function infiniteScrollPreloader() { |
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 BankPlayground do | |
| defmodule State do | |
| defstruct [:id, :date_created, :balance, :changes] | |
| @type t :: %State{} | |
| end | |
| defmodule AccountCreated do | |
| defstruct [:id, :date_created] | |
| @type t :: %AccountCreated{} |
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 BlogPost do | |
| defstruct [:title, :body, :published?] | |
| defmodule Drafted do | |
| defstruct [:title, :body] | |
| end | |
| end | |
| IO.puts inspect(%BlogPost.Drafted{}) |
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 Sandbox do | |
| def create(name, functions \\ []) when is_atom(name) and is_list(functions) do | |
| defmodule name do | |
| require Sandbox | |
| import Enum | |
| Sandbox.whitelist_functions(functions) | |
| defp allow(exp) when is_boolean(exp), do: exp | |
| defp allow(exp) when is_number(exp), do: exp |
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
| defmacro whitelist_literals(literals) do | |
| quote do | |
| for literal <- unquote(literals) do | |
| case literal do | |
| :boolean -> defp allow(exp) when is_boolean(exp), do: exp | |
| :number -> defp allow(exp) when is_number(exp), do: exp | |
| :integer -> defp allow(exp) when is_integer(exp), do: exp | |
| :float -> defp allow(exp) when is_float(exp), do: exp | |
| :tuple -> defp allow(exp) when is_tuple(exp), do: exp | |
| :list -> defp allow(exp) when is_list(exp), do: exp |
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 Sandbox do | |
| defmacro __using__(_env) do | |
| quote do | |
| import Sandbox, only: [whitelist: 1] | |
| def run(code) do | |
| code | |
| |> Code.string_to_quoted! | |
| |> Macro.prewalk(&allow/1) |