Skip to content

Instantly share code, notes, and snippets.

View .gitignore
.ipynb_checkpoints/
node_modules/
View power.exs
defmodule Power do
use Bitwise
def find(i) when i > 0 do
find(i, 1)
end
def find(i, p) when p < i do
find(i, p <<< 2)
end
View includes.rb
module ServiceOne
def helper_one
puts "one"
end
end
module ServiceTwo
def helper_two
puts "two"
end
View money.diff
diff --git a/lib/money/money/arithmetic.rb b/lib/money/money/arithmetic.rb
index 38bc94e..19d6b79 100644
--- a/lib/money/money/arithmetic.rb
+++ b/lib/money/money/arithmetic.rb
@@ -125,10 +125,10 @@ class Money
[:+, :-].each do |op|
define_method(op) do |other|
unless other.is_a?(Money)
- if other.zero?
+ if other && other.zero?
@iamvery
iamvery / lambda-calculus.ipynb
Last active Aug 1, 2018
A little Jupyter notebook illustrating some basic lambda calculus with JavaScript :)
View lambda-calculus.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View changeset_view.ex
defmodule PantsWeb.ChangesetView do
use PantsWeb, :view
@doc """
Traverses and translates changeset errors.
See `Ecto.Changeset.traverse_errors/2` and
`PantsWeb.ErrorHelpers.translate_error/1` for more details.
"""
def translate_errors(changeset) do
View versioned-router.diff
diff --git a/lib/pants_web/endpoint.ex b/lib/pants_web/endpoint.ex
index c24852a..a8ae2cf 100644
--- a/lib/pants_web/endpoint.ex
+++ b/lib/pants_web/endpoint.ex
@@ -45,7 +45,19 @@ defmodule PantsWeb.Endpoint do
signing_salt: "HqMY6W5G"
)
- plug(PantsWeb.Router)
+ def version(conn, []) do
View code.exs
quote do: {:a, :b, :c}
value = {:a, :b, :c}
Macro.escape(value)
quote do: value
value = {:a, :b, :c}
quote do: unquote(value)
View package.json
{
"name": "frontier",
"version": "0.1.0",
"private": true,
"devDependencies": {
"jest-expo": "~19.0.0",
"react-dom": "16.0.0-alpha.12",
"react-native-dotenv": "^0.1.0",
"react-native-scripts": "1.1.0",
"react-test-renderer": "16.0.0-alpha.12"
View una-chat.md