Skip to content

Instantly share code, notes, and snippets.


Thomas "Teflon Ted" Davis trak3r

View GitHub Profile

Before Chrome makes a cross-domain AJAX call it makes an OPTIONS check like this:

curl \
'' \
-H 'Access-Control-Request-Method: POST' \
-H 'Origin:' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36' \
-H 'Access-Control-Request-Headers: content-type' \
View spread_em_out.rb
module Delayed
class Worker
class << self
def sleep_delay_with_fudging
# stagger sleeps by +/- 10% so all the workers don't spike at same time
sleep_delay_without_fudging * rand(0.9..1.1)
alias_method_chain :sleep_delay, :fudging
View BrowserStack
The old prototype machine had our AWS API access key and secret key. Once the
hacker gained access to the keys, he created an IAM user, and generated a
key-pair. He was then able to run an instance inside our AWS account using
these credentials, and mount one of our backup disks. This backup was of one of
our component services, used for production environment, and contained a config
file with our database password. He also whitelisted his IP on our database
security group, which is the AWS firewall.
View gist:77cd0a40004cef6a704e
This is what i see in my unite buffer:
28 a app/assets/javascripts/backbone/ [coffee] (2014/06/09 16:10:54)
27 %a app/assets/javascripts/backbone/ [coffee] (2014/06/09 16:57:00)
The file names are so grossly truncated as to be useless.
1. Can I truncate the path prefixes instead of the file names? If so, how?
2. Can I kill the file type and time stamp columns? If so, how?
View unite-command-t
call unite#filters#matcher_default#use(['matcher_fuzzy'])
call unite#custom#source('buffer,file,file_rec/git','sorters', 'sorter_selecta')
nnoremap <leader>t :<C-u>Unite -no-split -buffer-name=files -profile-name=buffer -start-insert file_rec/git<CR>
call unite#custom#profile('buffer', 'ignorecase', 1)
View test.txt
this is a test of gist from vim.
this gist was edited by a fresh vim copy.
View kid driving learners permit insurance
"... in most cases, your policy will protect your young driver until he or she
is licensed."
"... as long as the adult driver who owns the car is covered the child will be
too. However, some companies require notification."

Syntax highlight SQL inside Ruby <<-SQL heredocs

Embeds SQL syntax highlighting inside Ruby heredocs labeled SQL. This will also work to embed other syntaxen, e.g., HTML.

Optional PGSQL enhanced syntax:


    syntax include @SQL syntax/pgsql.vim
doing a big activerecord query with a lot of peripheral objects.
adding ".includes" (preloading) speeds it up dramatically by squashing all the
the page then renders fast and spits this out into the logs:
Completed 200 OK in 504ms (Views: 104.2ms | ActiveRecord: 86.0ms)
however, it is then *** 90 SECONDS *** until the page is actually sent down to
root = exports ? this
root.TedTabs ?= {}
TedTabs.activateFirstNestedTabRecursively = (href, depth = 1) ->
if wrapper = $(document).find(href)
# activate the first nested tab link
if firstTab = wrapper.find("a[data-toggle=\"tab\"]").first() "show"
You can’t perform that action at this time.