This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################ | |
# A more comprehensive drop-in replacement for Rails' internal link matcher regex | |
# which I invented from scratch... Oh yeah, Adderall is awesome. | |
# Takes about 40% longer to run than the stock auto_link regex in our test suite unfortunately :( | |
# but it accounts for pretty much EVERY linkable URI/URL, and is far more (in my opinion) | |
# readable and maintainable, due to its use of named groups/tokens. | |
# References used to build this: | |
# http://www.faqs.org/rfcs/rfc1738.html | |
# http://tools.ietf.org/html/rfc3986 | |
# http://en.wikipedia.org/wiki/URI_scheme << primary ref, was awesome, great diagram |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# requires socksify gem | |
require "socksify" | |
require 'socksify/http' | |
# use w/ OAuth2 like OAuth2::Client.new(id, secret, connection_opts: { proxy: 'socks://127.0.0.1:9050' }) | |
class Faraday::Adapter::NetHttp | |
def net_http_class(env) | |
if proxy = env[:request][:proxy] | |
if proxy[:uri].scheme == 'socks' | |
Net::HTTP::SOCKSProxy(proxy[:uri].host, proxy[:uri].port) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a | |
function! s:align() | |
let p = '^\s*|\s.*\s|\s*$' | |
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p) | |
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g')) | |
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*')) | |
Tabularize/|/l1 | |
normal! 0 | |
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.')) |
NewerOlder