View keybase.md

Keybase proof

I hereby claim:

  • I am rstacruz on github.
  • I am rstacruz (https://keybase.io/rstacruz) on keybase.
  • I have a public key ASBAlJ47D5eV-hAb3h9cOHcMOHH_vDEmTqNH6Zt2yPRl0Ao

To claim this, I am signing this object:

View rot13.ex
defmodule Rotator do
def encode(string, shift \\ 13)
def encode(<<char>> <> tail, shift) do
<<rotate(char, shift)>> <> encode(tail, shift)
end
def encode(_, _), do: ""
def rotate(char, shift) when ((char >= ?a) and (char <= ?z)) do
?a + rem(char - ?a + shift, 26)
View notice_notification.js
import $ from 'jquery'
import onmount from 'onmount'
/*
* Simple behavior to show a toast notification
* (simplified for the sake of illustration)
*/
onmount('[data-js-notice-notification]', function () {
const $this = $(this)
View pi.js
const PHI = (Math.sqrt(5) + 1) / 2
function divisor (n) {
if (n === 0) return Math.sqrt(2 + PHI)
var last = divisor(n - 1)
return Math.sqrt(2 + last)
}
function pi (n) {
View 0-media-query-snippets.md

Media query snippets

Type b4+ then press TAB. It expands to

@media (min-width: $screen-xs-min) { // > 480px

Snippets

View family-tree.md

family-tree

Writing a family tree

Let's start with families. Every family can have parents and children.

+families:
+  - parents: [Marge, Homer]
+    children: [Bart, Lisa, Maggie]
View vim powerlevelling.md

Text objects

vip - select IN paragraph
vap - select AROUND paragraph

also: ( [ ' " t

% - go to opening/closing ( or [ or <tag>
View µredux.js
var INIT = '@redux/INIT'
function createStore (reducer, state, enhancer) {
if (enhancer) return enhancer(createStore)(reducer, state)
var subscribers = []
dispatch({ type: INIT })
return {
View bundle-js.md

bundle-js

Batteries-included, minimal-configuration JS bundler

A hypothetical JavaScript bundler. bundle-js aims to be your one-stop-shop for everything in the JS frontend. Goals:

  • Batteries-included: you should be able to use bundle-js without any plugins or any fancy configuration.
  • Convention over configuration: there should be little need to configure bundle-js.
  • One dependency: no more dealing with webpack, loaders, babel, babel presets, babel plugins, and so on!
  • Extensible: it should still be possible to extend functionality if necessary.
View slug_generator.ex
defmodule SlugGenerator do
@moduledoc """
Generates random slugs.
def changeset(model, params \\ %{}) do
model
|> cast(params, @fields)
|> SlugGenerator.generate_slug(Article, :slug, to_slug(changeset))
end