I hereby claim:
- I am rsgrafx on github.
- I am tuplelife (https://keybase.io/tuplelife) on keybase.
- I have a public key ASDF1I-_D-XnbfleX_TCVlZjgcwtlbG5udGTKxSPJIyWSAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
defmodule Flattery do | |
def run({a, b}, acc) | |
when is_map(b) == false, | |
do: Map.merge(acc, %{a => b}) | |
def run({_a, b}, acc) | |
when is_map(b), | |
do: go(b, acc) | |
def run({a, b}, acc), |
'.source.elixir': | |
'Iex Pry': | |
'prefix':'pry' | |
'body': """ | |
require IEx | |
IEx.pry() | |
""" | |
'New GenServer': | |
'prefix':'genmod' | |
'body': """ |
defmodule Queens do | |
@type t :: %Queens{black: {integer, integer}, white: {integer, integer}, grid: List.t()} | |
defstruct black: nil, white: nil, grid: nil | |
@doc """ | |
Creates a new set of Queens | |
""" | |
@spec new({integer, integer}, {integer, integer}, integer) :: t() | |
def new(white \\ {0, 3}, black \\ {7, 3}, grid \\ 8) |
# Ecto - Model | |
defmodule YourPhoenixApp.PaperclipAvatar do | |
use YourPhoenixApp.Web, :model | |
alias YourPhoenixApp.{Repo, PaperclipAvatar} | |
# | |
# There are places in my existing app where only the avatar image is required. | |
# So I created a module that sole purpose was to read that data. | |
# | |
schema "users" do | |
field :avatar_file_name, :string |
defmodule Citrusbyte do | |
@moduledoc """ | |
This module - demonstrates use of pattern matching in Elixir to modify a list. | |
[[1,2,[3]],4] -> [1,2,3,4] | |
Usage: | |
Citrusbyte.example [[1,2,[3]],4] #=> [1,2,3,4] | |
""" |
defmodule Bicycle do | |
defstruct [wheels: 2, pedals: nil, seat: nil, pass: nil] | |
end | |
defmodule BikeTypeCheck do | |
def check(%Bicycle{wheels: count, pedals: val}=bike) do | |
return = with {:ok, 2} <- count_wheels(count), | |
{:ok, true} <- has_pedals(val), | |
do: pedal_away(bike) |
# | |
# Specifically written for - this problem with folders unzipped from this https://www.prepbootstrap.com website. | |
# may be able to help someone solve similar issue. | |
# | |
# Problem: Folder contains no folder structure - but hints at them in the file names: | |
# / | |
# Theme-LightWayAdmin\blog.html | |
# Theme-LightWayAdmin\font-awesome\less\list.less | |
# Theme-LightWayAdmin\bootstrap-elements.html | |
# Theme-LightWayAdmin\font-awesome\less\mixins.less |
puts "#{ENV['RUBY_VERSION']}" | |
require 'rubygems' | |
require 'httparty' | |
require 'forwardable' | |
module Rulers | |
module Model | |
module HttpModel |
#!/usr/bin/env ruby | |
OUTSIDE_STATE = true | |
NAMES = {:objects => []} | |
module CheckSelf | |
module ClassMethods | |
def self.inherited(child) | |
::NAMES[:objects] << child | |
end |