Skip to content

Instantly share code, notes, and snippets.

View dwhelan's full-sized avatar

Declan Whelan dwhelan

View GitHub Profile
@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')
@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
]
)
@jessejanderson
jessejanderson / macros.md
Last active March 26, 2024 08:33
Don't Write Macros (but do learn how they work)
@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.
@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
# 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) }
@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@