I hereby claim:
- I am aditya7iyengar on github.
- I am aditya7iyengar (https://keybase.io/aditya7iyengar) on keybase.
- I have a public key whose fingerprint is F956 2A78 29A7 D4C5 2FCE 7ED5 B2BC 1EDB 6C09 4020
To claim this, I am signing this object:
# Given an input, this program returns a list of all primes numbers less than the input. | |
defmodule NPrimes do | |
def get_primes(n) when n < 2, do: [] | |
def get_primes(n), do: Enum.filter(2..n, &is_prime?(&1)) | |
defp is_prime?(n) when n in [2, 3], do: true | |
defp is_prime?(x) do | |
start_lim = div(x, 2) | |
Enum.reduce(2..start_lim, {true, start_lim}, fn(fac, {is_prime, upper_limit}) -> |
# Given a string, string, you have to find out the number of unique strings | |
# (including string itself) that can be produced by re-arranging the letters | |
# of the string. | |
# Example: | |
# | |
# string = "ABC" | |
# | |
# uniqcount(string) = 6 #=> ["ABC", "ACB", "BAC", "BCA", "CAB", "CBA"] | |
# | |
# Notes: Find the number of UNIQUE strings! |
# In mathematics, this is called a fixpoint. We pass an argument to a function and the result is that argument. | |
# Here the argument is the factorial function. It could just be a number; for example, zero and | |
# one are fixpoints of x = x ^2 (x squared). In lambda calculus speak, when H is applied to factorial | |
# the result is factorial. Or, calling H with argument factorial returns factorial. factorial is a fixpoint of H. | |
# H.call(factorial_with_H).call(5) | |
# ------------------------------------------------------------------------ | |
# FizzBuzz | |
# ------------------------------------------------------------------------ |
defmodule RummageExample.Router do | |
use RummageExample.Web, :router | |
pipeline :browser do | |
plug :accepts, ["html"] | |
plug :fetch_session | |
plug :fetch_flash | |
plug :protect_from_forgery | |
plug :put_secure_browser_headers | |
end |
defmodule RummageExample.Product do | |
use RummageExample.Web, :model | |
use Rummage.Ecto, repo: RummageExample.Repo, per_page: 2 # <-- Add this | |
schema "products" do | |
field :name, :string | |
field :category, :string | |
field :quantity, :integer | |
timestamps() |
<h2>Listing products</h2> | |
<table class="table"> | |
<thead> | |
<tr> | |
<th>Name</th> | |
<th>Price</th> | |
<th>Category</th> | |
<th></th> |
license: mit |
I hereby claim:
To claim this, I am signing this object:
defmodule GenTestUtils.Module do | |
@moduledoc """ | |
Helper functions to test parts of an Elixir module | |
""" | |
require ExUnit.Assertions | |
@doc """ | |
Tests whether a module delegates a given MFA to another given MFA | |
# Usage |
<!-- Add Bulma for Columns (best way is to add this to the theme, but adding it here | |
so it can be easily re-used) --> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.3/css/bulma.min.css" integrity="sha512-IgmDkwzs96t4SrChW29No3NXBIBv8baW490zk5aXvhCD8vuZM3yUSkbyTBcXohkySecyzIrUwiF/qV0cuPcL3Q==" crossorigin="anonymous" referrerpolicy="no-referrer" /> | |
<script> | |
// assign elements | |
const editorRoot = document.getElementsByClassName("DraftEditor-root")[0] | |
const editorContainer = document.getElementsByClassName("DraftEditor-editorContainer")[0] | |
var splitImageColumn = document.getElementById('splitImageColumn') |