Skip to content

Instantly share code, notes, and snippets.

View bjmiller121's full-sized avatar

BJ Miller bjmiller121

View GitHub Profile
@bjmiller121
bjmiller121 / multiple-push-urls.md
Last active March 4, 2024 05:47
Add multiple push URLs to a single git remote

Sometimes you need to keep two upstreams in sync with eachother. For example, you might need to both push to your testing environment and your GitHub repo at the same time. In order to do this simultaneously in one git command, here's a little trick to add multiple push URLs to a single remote.

Once you have a remote set up for one of your upstreams, run these commands with:

git remote set-url --add --push [remote] [original repo URL]
git remote set-url --add --push [remote] [second repo URL]

Once set up, git remote -v should show two (push) URLs and one (fetch) URL. Something like this:

@bjmiller121
bjmiller121 / jquery.slideHeight.js
Created July 14, 2015 20:03
Re-implementation of jQuery slideUp() and slideDown() to avoid display: none;
/*
A re-implementation of jQuery's slideDown() and slideUp() that animates the
height of an element without requiring the use of display: none;
Helpful when needing to hide a video player while maintaining control via an
API.
The element must have "overflow: hidden;" set in CSS for this to work properly.
In order to have the element hidden by default, you mist also set "height: 0;"
in CSS as well.
# Don't cache anything
<ifModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
</ifModule>
@angrytoast
angrytoast / translate.md
Last active August 29, 2015 14:12
OnTour Translation

OnTour Translation Starting point

  • /admin/tmgmt/sources

Translating Pages (this may mean both pages and field collections)

  • In general, pages will not have anything to translate beyond the title because everything should be in field_collection sections
  • The labels for standard pages can be confusing in the TMGMT interface, so it may be quicker to get the translation for the page title, and then update by hand.

Field Collections

  • /admin/tmgmt/sources
@jtwalters
jtwalters / git-grepwords
Last active July 19, 2016 09:11
Grep multiple words in your git commit message history
# Example use: find commit messages that contain pattern1 and pattern2
# $ git grepwords pattern1 pattern2
# Ensure we have at least one param (a pattern)
[ -n "$1" ] || { echo "usage: $0 PATTERN..." >&2; exit 1; }
pattern=""
# Append all remaining patterns
while [ -n "$1" ]; do
{
"alignment_chars":
[
"=",
":"
],
"alignment_space_chars":
[
"=",
":"
@angrytoast
angrytoast / release_template
Last active July 14, 2021 09:29
GitHub Release Template
# DATE - "RELEASE NAME" #1000009
![ALT TEXT](IMAGE_URL "IMAGE TITLE")
### New Features / Projects
* __PROJECT / FEATURE__ [#42] - by @person
* __PROJECT / FEATURE__ [#42] - by @person
* __PROJECT / FEATURE__ [#42] - by @person
* __PROJECT / FEATURE__ [#42] - by @person
@angrytoast
angrytoast / omghosts
Created April 10, 2014 23:39
omg hosts
#! /usr/bin/env bash
PROBLEM="$(cat /etc/hosts | grep tableausoftware.com | grep -v '^#' | wc -w)"
if [ "$PROBLEM" -gt 0 ]; then
say omg fix yer hosts
fi
@mshafrir
mshafrir / states_hash.json
Created May 9, 2012 17:05
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter