Skip to content

Instantly share code, notes, and snippets.


Paul Smith paulcsmith

View GitHub Profile
paulcsmith / gist:7472916
Created Nov 14, 2013
My key bindings for pairing with someone using VIM
View gist:7472916
" Type jj in insert mode to escape to command mode
:imap jj <Esc>
" Type j; in insert mode to escape to command mode with a : already typed
:imap j; <Esc>:
" Type ;w in insert mode to escape to command mode with :w already typed
:imap ;w <Esc>:w
" Use semicolon instead of colon. Don't have to hit shift now
map ; :
View citizenship_status.rb
module Colleague::Classes
class CitizenshipStatus
include Processor
def process_field(value)
AlienStatus.find_code( value )
paulcsmith / gist:4a9c014b5702e10ab904
Created Jan 14, 2015
SkyLabels Start SASS template
View gist:4a9c014b5702e10ab904
.sky-label {
input, textarea { /* How the input looks without focus or text */ }
label { /* How the input looks without focus or text */ }
.sky-label-focused, .sky-label-has-text {
input, textarea { /* How the inputs look while focused or with text (and blurred) */ }
label {}
View announcements_channel_test.ex
defmodule AnnouncementChannelTest do
use ConstableApi.TestWithEcto, async: false
alias Phoenix.Socket
alias Phoenix.Socket.Message
alias ConstableApi.Repo
alias ConstableApi.Announcement
alias ConstableApi.AnnouncementChannel
test "announcements:index returns announcements with ids as the key" do
paulcsmith / gist:08f9763fb88290e3f7ea
Created Feb 26, 2015
Elixir module doc from readme
View gist:08f9763fb88290e3f7ea
paulcsmith / test_helper.exs
Last active Jun 22, 2016
Longer backtrace/stacktrace in Erlang/Elixir
View test_helper.exs
# Works great in test/test_helper.exs
:erlang.system_flag :backtrace_depth, 50
View gist:dcb8adb3749cfec00960
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
paulcsmith / comment_view.ex
Last active Aug 29, 2015 — forked from jeregrine/comment_view.ex
Rendering JSON with views
View comment_view.ex
defmodule MyApp.CommentView do
use MyApp.Web, :view
@attributes ~W(id name inserted_at)
def render("index.json", %{data: comments}) do
for comment <- comments, do: render("show.json", %{data: comment})
def render("show.json", %{data: comment}) do
paulcsmith / gist:2615513d0602915fb98b
Created Mar 19, 2015
Complex Ecto Queries with joins and deep preload
View gist:2615513d0602915fb98b
def with_sorted_comments do
from a in Announcement,
left_join: c in assoc(a, :comments),
left_join: u in assoc(c, :user),
order_by: [asc: c.inserted_at],
preload: [:interests, :user, comments: {c, user: u}]
View gist:959d58b9b4cec1fd5b85
"<?xml version=\"1.0\" encoding=\"utf-8\"?><cfdi:Comprobante xsi:schemaLocation=\"\" version=\"3.2\" folio=\"22\" LugarExpedicion=\"NOGAL 10 , SAN JOSE DE LOS CEDROS, 05200, DELEGACION CUAJIMALPA, DISTRITO FEDERAL, MEXICO\" NumCtaPago=\"NO IDENTIFICADO\" TipoCambio=\"1.00\" Moneda=\"Peso Mexicano\" fecha=\"2014-01-29T20:41:07\" sello=\"gO/DyxBs7kneK2dRySKmKshc1ddFXj+XcoPUrlgHYNyGeeuXGHW81URpiy20wIMpUmtZf8yne+5+jHMTqachVghB4IRkJwUNiFNPmc5K/vxiY/VWzalzQtrkBKZh7LWs/yrinvoiP1H4h8t/yOsiw+8NRwSDfcV6g70b3jnZRKg=\" formaDePago=\"PAGO EN UNA SOLA EXHIBICION\" noCertificado=\"00001000000301474075\" certificado=\"MIIEdzCCA1+gAwIBAgIUMDAwMDEwMDAwMDAzMDE0NzQwNzUwDQYJKoZIhvcNAQEFBQAwggGKMTgwNgYDVQQDDC9BLkMuIGRlbCBTZXJ2aWNpbyBkZSBBZG1pbmlzdHJhY2nDs24gVHJpYnV0YXJpYTEvMC0GA1UECgwmU2VydmljaW8gZGUgQWRtaW5pc3RyYWNpw7NuIFRyaWJ1dGFyaWExODA2BgNVBAsML0FkbWluaXN0cmFjacOzbiBkZSBTZWd1cmlkYWQgZGUgbGEgSW5mb3JtYWNpw7NuMR8wHQYJKoZIhvcNAQkBFhBhY29kc0BzYXQuZ29iL