Skip to content

Instantly share code, notes, and snippets.

View samjonester's full-sized avatar

Sam Jones samjonester

View GitHub Profile
@samjonester
samjonester / schema.ex
Created March 8, 2019 02:56
Making Schema
defmodule Schema do
defmacro field(field_key) do
quote do
Module.put_attribute(__MODULE__, :schema_fields, unquote(field_key))
end
end
defmacro schema(do: block) do
prelude =
quote do
@samjonester
samjonester / rundown.md
Created March 4, 2019 20:23
Blocks, Procs, Lambdas in Ruby
  • blocks {|a| … } & do ... end: closures with loose arity (like js functions) that you can yeild to in a method. All methods can accept a block without any change to their signature. You can yield conditionally if a block is given.
class Foo
  def map
    yield(1,2,3) if block_given?
  end
end

Foo.new.map { |one| ... } # <= doesn't matter that arity is inconsistent
@samjonester
samjonester / elixir_libs.md
Last active January 23, 2019 20:08
Elixir Info

Libraries for some things

  • Releases
    • distillery
  • Testing (factories, mocks??, date stuff)
  • HTTP
  • Poison - JSON parsing/dumping
@samjonester
samjonester / signing_commits.md
Last active June 13, 2018 20:27
Signing Git Commits

OpenPGP is a standard for encryption and signing

  • https://en.wikipedia.org/wiki/Pretty_Good_Privacy#OpenPGP
  • Pairs of public and private keys
  • To send you an encrypted document, I encrypt it with your public key, then only your private key can open it
  • Singing verifies the sender. You sign with your private key, and then anyone with your public key can verify that it was truely you who sent it.

PGP vs GPG

  • PGP is a proprietary implementation and GPG is a Gnu implementation of OpenPGP

Web of Trust

@samjonester
samjonester / How.md
Last active May 23, 2022 11:36
Tmate + Tmux pairing!

Tmate + Tmux pairing

Tmate is used as the "free reverse ssh tunnel". It is not super secure because a key is not required to connect, but it sure is conventient. Tmux is used inside the Tmate session to share multiple terminal windows


Here's the situation.

You've createe a new tmux session where you will do your work named foo.

@samjonester
samjonester / Makefile
Last active April 13, 2017 00:48
Make File Stuff
VERSION ?= $(shell cat VERSION)
.PHONY: help version clean bump release
.DEFAULT_GOAL := help
build: ## build the app
do stuff
clean: ## clean artifacts
rm -rf build
@samjonester
samjonester / Do_I_Really_Need_To_Test_That.md
Last active January 3, 2017 14:07
Do I Realy Need To Test That!?

Do I Really Need To Test That!?

Abstract

That test is hurting your test suite! Tests at the application's edge fail in strange ways and erode confidence in your test suite. You'll learn why Integrations and the edges are not meant to be tested, and also how to make your own decision and not listen to me! We'll practice thinking through test design at one of the more difficult areas of an application and how to purposefully break the rules.

Details

Not all tests are created equal. Some tests erode confidence in your test suite, and make it slow. You'll see examples of these tests at the edge of your application. You'll learn why those areas shouldn't be tested. More importantly, though, you'll learn how to make these decisions for yourself. After all, what good are rules if you can never break them?

@samjonester
samjonester / Life_After_Nil.md
Last active December 28, 2016 03:01
Life After Nil

Life After Nil

Abstract

Ruby is late to the type system party. Let’s give Ruby something smart to say when it gets there. You’ll take a journey with Haskell’s type system. Along the way, you’ll learn how types can let you forget about nil, declaratively model your domain, and allow your compiler to drive your design.

Details

How can ANYONE be productive in a language without if/else, while, or even classes? Let me show you!

### Keybase proof
I hereby claim:
* I am samjonester on github.
* I am samjonester (https://keybase.io/samjonester) on keybase.
* I have a public key whose fingerprint is E469 ECFB 07C5 8720 5550 78B0 CE96 F22A DBBA DFA8
To claim this, I am signing this object: