Skip to content

Instantly share code, notes, and snippets.

View mhaylock's full-sized avatar

Mark Haylock mhaylock

  • abitofthought.com
  • Christchurch, New Zealand
View GitHub Profile
/**
* Created at 03/17/2017
* Developed by Jorge Cuesta <jorge.s.cuesta@gmail.com>
* Developed by Jeffrey Soriano <jeffreysoriano5@gmail.com>
*/
// ### Use cases
/*
keys & data -> result
@randallreedjr
randallreedjr / heroku-remote.md
Last active April 25, 2024 07:06
Add a Heroku remote to an existing git repo

Working with git remotes on Heroku

Generally, you will add a git remote for your Heroku app during the Heroku app creation process, i.e. heroku create. However, if you are working on an existing app and want to add git remotes to enable manual deploys, the following commands may be useful.

Adding a new remote

Add a remote for your Staging app and deploy

Note that on Heroku, you must always use master as the destination branch on the remote. If you want to deploy a different branch, you can use the syntax local_branch:destination_branch seen below (in this example, we push the local staging branch to the master branch on heroku.

$ git remote add staging https://git.heroku.com/staging-app.git
@aaugustin
aaugustin / question.md
Last active January 4, 2023 05:04
Accessibility in browsers: zoom level vs. font size

Scroll to the bottom for the answer

Question

There's two ways to increase the default font size in browsers:

  1. set a default zoom level > 100% ("page zooming")
  2. set a default font size > 16px ("text scaling")

Option 1 relies on the browser's proportional scaling. This feature was

@Integralist
Integralist / Datadog Monitoring and Metrics.md
Last active January 23, 2024 21:17
[Datadog Monitoring and Metrics] #datadog #metrics #monitoring #cost
@alexdiliberto
alexdiliberto / evented_service.js
Created October 20, 2015 00:12
Pattern for dispatching events from Services in Ember
// app/services/locale.js
export default Ember.Service.extend(Ember.Evented, {
init() {
this._super(...arguments);
// initialize locales from localStorage (or URL string)
},
currentLocale() {
return ...;
@terenceponce
terenceponce / profile_management_spec.rb
Last active July 13, 2020 02:22
Creating Signed Cookies in Capybara
# spec/features/profile_management_spec.rb
require 'rails_helper'
feature 'Profile Management', type: :feature do
given!(:user) { create(:user) }
scenario 'User updates profile' do
cookie = SignedCookieGenerator.new(:auth, user.id)
page.driver.browser.set_cookie(cookie.to_s)
@brettchalupa
brettchalupa / instructions.md
Last active January 13, 2017 03:23 — forked from wrburgess/gist:5528649
Backup Heroku Postgres database and restore to local database

How To Use Heroku Postgresql Database Locally

https://devcenter.heroku.com/articles/heroku-postgres-import-export

or

  1. Create a new database backup - heroku pg:backups capture
  2. Request and copy the URL - heroku pg:backups public-url
  3. Download the database backup - curl "[the url]" > tmp/db.dump
  4. Restore the backup - pg_restore --verbose --clean --no-acl --no-owner -h localhost -d [db_name] tmp/db.dump
@carcinocron
carcinocron / debugger pause beforeunload
Last active April 25, 2024 16:48
Chrome: pause before redirect
// Run this in the F12 javascript console in chrome
// if a redirect happens, the page will pause
// this helps because chrome's network tab's
// "preserve log" seems to technically preserve the log
// but you can't actually LOOK at it...
// also the "replay xhr" feature does not work after reload
// even if you "preserve log".
window.addEventListener("beforeunload", function() { debugger; }, false)
@edvinasbartkus
edvinasbartkus / gist:0e99ea8305a20737f562
Last active May 20, 2022 11:08
Ruby puma.gem install on El Capitan / Mac Sierra
gem install puma -- --with-cppflags=-I/usr/local/opt/openssl/include --with-ldflags=-L/usr/local/opt/openssl/lib
@jeebak
jeebak / Vagrantfile
Last active January 23, 2020 22:34 — forked from anthonysterling/Vagrantfile
A vagrant replacement for ievms (for Linux, and macOS hosts)
# Usage: vagrant up windowsVersion-IEversion
#
# Eg. vagrant up win10-edge
#
# Based off of: # https://gist.github.com/anthonysterling/7cb85670b36821122a4a
boxes = {
# http://www.vagrantbox.es/
"xp-6" => "http://aka.ms/ie6.xp.vagrant",
"xp-8" => "http://aka.ms/ie8.xp.vagrant",
"vista-7" => "http://aka.ms/ie7.vista.vagrant",