Skip to content

Instantly share code, notes, and snippets.

View dwhelan's full-sized avatar

Declan Whelan dwhelan

View GitHub Profile
@gtanner
gtanner / .screenrc
Created July 10, 2012 14:22
My remote XP screen settings
startup_message off
vbell off
defscrollback 512
shell -$SHELL
shelltitle sh
autodetach on
# enable SHIFT-PGUP / SHIFT-PGDOWN scroll
termcapinfo rxvt ti@:te@
# RSpec matcher to spec delegations.
# Forked from https://gist.github.com/ssimeonov/5942729 with fixes
# for arity + custom prefix.
#
# Usage:
#
# describe Post do
# it { should delegate(:name).to(:author).with_prefix } # post.author_name
# it { should delegate(:name).to(:author).with_prefix(:any) } # post.any_name
# it { should delegate(:month).to(:created_at) }
@zampino
zampino / struct_extension.ex
Last active July 20, 2022 00:32
Elixir Extending a Struct
defmodule DSL do
defmacro extend_struct struct_mod, keyword do
quote do
defstruct Keyword.merge(Map.to_list(Map.from_struct(unquote(struct_mod).__struct__)), unquote(keyword))
end
end
end
@Qqwy
Qqwy / elixir_operator_info.exs
Created July 7, 2016 20:01
Elixir Operator Info
# See https://github.com/elixir-lang/elixir/blob/master/lib/elixir/src/elixir_parser.yrl#L52
# for the list of operators with associativity, etc.
# The operators in this list are grouped by precedence, low to high.
# The comments indicate the operator's normal function, as well as its ability to be defined/overridden.
-> # CompileError 'unhandled operator'. only allowed in anonymous function syntax.
& # CompileError, only allowed in short anonymous function syntax.
@jessejanderson
jessejanderson / macros.md
Last active October 28, 2024 00:58
Don't Write Macros (but do learn how they work)
@dwhelan
dwhelan / test_helper.exs
Last active May 24, 2018 00:38
Replicate RSpec "focus" mode with ExUnit
ExUnit.start(
exclude: [:skip], include: [
# Uncomment the line below to only run tests with "@tag :focus"
:focus], exclude: [:test
]
)
@forivall
forivall / axios-timing.ts
Last active March 21, 2024 16:38
Axios Timing helper POC
import http = require('http')
import https = require('https')
import url = require('url')
import {AxiosInstance, AxiosInterceptorManager} from 'axios'
import {HttpRequestOptions as HttpFollowRequestOptions, http as httpFollow, https as httpsFollow} from 'follow-redirects'
import now = require('performance-now')
import httpAdapter = require('axios/lib/adapters/http')
import InterceptorManager = require('axios/lib/core/InterceptorManager')