Skip to content

Instantly share code, notes, and snippets.

Avatar

Rhett Sutphin rsutphin

View GitHub Profile
@nolanlawson
nolanlawson / protips.js
Last active Nov 16, 2020
Promise protips - stuff I wish I had known when I started with Promises
View protips.js
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@rsutphin
rsutphin / tag_and_push_tag.cap
Last active Apr 18, 2018
A capistrano 3 task to tag the repo after every deploy
View tag_and_push_tag.cap
# Requires Capistrano 3.2 or later
namespace :deploy do
after :finishing, :tag_and_push_tag do
on roles(:app) do
within release_path do
set(:current_revision, capture(:cat, 'REVISION'))
# release path may be resolved already or not
resolved_release_path = capture(:pwd, "-P")
@mislav
mislav / gist:938183
Created Apr 23, 2011
Faraday SSL example
View gist:938183
connection = Faraday::Connection.new('http://example.com') do |builder|
builder.request :url_encoded # for POST/PUT params
builder.adapter :net_http
end
# same as above, short form:
connection = Faraday.new 'http://example.com'
# GET
connection.get '/posts'
View workaround-for-deleting-cookies.rb
# selenium-webclient does not clean up cookies unless your currently on that page.
module CookieRemover
def self.delete_all(path)
Capybara.current_session.driver.visit(path)
Capybara.reset_sessions!
end
end
After("@external-site") do
CookieRemover.delete_all("http://www.external-site.com")
You can’t perform that action at this time.