Skip to content

Instantly share code, notes, and snippets.

Thomas "Teflon Ted" Davis trak3r

Block or report user

Report or block trak3r

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View help_cors.md

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

curl \
'https://fubar.com/users/sign_in' \
-X OPTIONS \
-H 'Access-Control-Request-Method: POST' \
-H 'Origin: http://snafu.com' \
-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)
end
alias_method_chain :sleep_delay, :fudging
end
end
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/comp..ews.js.coffee [coffee] (2014/06/09 16:10:54)
27 %a app/assets/javascripts/backbone/comp..ler.js.coffee [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
http://www.esurance.com/car-insurance-info/teen-driver-insurance-faq#ch7
"... in most cases, your policy will protect your young driver until he or she
is licensed."
http://www.carinsurancecomparison.com/if-your-child-gets-a-learners-permit-do-yo
u-have-to-add-them-to-your-auto-insurance-policy/
"... as long as the adult driver who owns the car is covered the child will be
too. However, some companies require notification."
View README.md

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:

(requires https://github.com/exu/pgsql.vim)

    syntax include @SQL syntax/pgsql.vim
View preloading.wtf
doing a big activerecord query with a lot of peripheral objects.
adding ".includes" (preloading) speeds it up dramatically by squashing all the
N+1's.
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
View teds_tabs.js.coffee
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()
firstTab.tab "show"
You can’t perform that action at this time.