Skip to content

Instantly share code, notes, and snippets.

John Karahalis openjck

Block or report user

Report or block openjck

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
@openjck
openjck / .gitconfig
Created Mar 25, 2019
Git alias to check out the first committed version of a file.
View .gitconfig
# Git alias to check out the first committed version of a file.
#
# For example:
#
# $ ls
# index.js LICENSE README
# $ git get-first-version index.js
# $ ls
# index.js index.js.first-version LICENSE README
@openjck
openjck / wait-for-internet-connection.sh
Created Oct 4, 2018
Test the internet connection and print a message once one is established
View wait-for-internet-connection.sh
#!/usr/bin/env bash
echo "Testing..."
PING_CMD="ping -t 3 -c 1 google.com > /dev/null 2>&1"
eval $PING_CMD
if [[ $? -eq 0 ]]; then
echo "Already connected."
else
@openjck
openjck / metrics-graphics-#783.html
Last active Dec 22, 2017
HTML document demonstrating the issue described in metricsgraphics/metrics-graphics#783
View metrics-graphics-#783.html
<!doctype html>
<html lang="en-US" dir="ltr">
<head>
<meta charset="utf-8" />
<title>Example</title>
<link href="https://rawgit.com/mozilla/metrics-graphics/b363d82c229fba6a280c9782b8154aad0ac901e7/dist/metricsgraphics.css" rel="stylesheet" />
</head>
<body>
<div id="target"></div>
@openjck
openjck / metrics-graphics-#764.html
Last active Aug 8, 2017
HTML document demonstrating the issue described in metricsgraphics/metrics-graphics#764
View metrics-graphics-#764.html
<!doctype html>
<html lang="en-US" dir="ltr">
<head>
<meta charset="utf-8" />
<title>Example</title>
<link href="https://rawgit.com/mozilla/metrics-graphics/4722d8a7aaaea604a942f6b39bd169b9bfa815fb/dist/metricsgraphics.css" rel="stylesheet" />
</head>
<body>
<div id="target"></div>
@openjck
openjck / bookmarklet-remove-wikipedia-pictures.js
Last active Mar 8, 2016
Simple bookmarket to remove pictures in Wikipedia articles
View bookmarklet-remove-wikipedia-pictures.js
javascript:(function(){$('#mw-content-text .thumb, #mw-content-text img').remove();})();
@openjck
openjck / bookmarklet-remove-wikipedia-links.js
Last active Mar 7, 2016
Simple bookmarket to remove distracting links in Wikipedia articles
View bookmarklet-remove-wikipedia-links.js
View avoiding-fouc-with-optimizely.html
{# Randomly determine if the new heading should be shown #}
{% set show_new_heading = random_boolean() %}
{% if show_new_heading %}
<h1>The Best Documentation Around</h1>
{% endif %}
<script>
window['optimizely'] = window['optimizely'] || [];
@openjck
openjck / fix-static-drupal-site-filenames.sh
Last active Jan 18, 2016
Script that restores original filenames (misc/drupal/index.js -> misc/drupal.js) after following the steps in this article: http://webikon.com/cases/park-your-old-drupal-site
View fix-static-drupal-site-filenames.sh
#!/bin/bash
# Fix filenames after making a static copy of a Drupal website. This script
# should only be run after following all of the steps in this article:
#
# http://webikon.com/cases/park-your-old-drupal-site
#
# When the steps in the article are followed, all files are renamed to
# index.[ext], so you end up with a bunch of files like misc/drupal.js.
# This script restores the original filenames (e.g., misc/drupal.js), and
@openjck
openjck / filter-branch-prepend-and-append
Created Dec 11, 2014
Using sed and filter-branch to prepend and append to Git commit messages without newlines
View filter-branch-prepend-and-append
# Prepending text to the five most recent commit messages:
git filter-branch --msg-filter 'sed "s/\(.*\)/[prepended text] \1/g"' HEAD~5..HEAD
# Appending text to the five most recent commit messages:
git filter-branch --msg-filter 'sed "s/\(.*\)/\1 [appended text]/g"' HEAD~5..HEAD
@openjck
openjck / kuma-vagrant-reset.sh
Last active Aug 29, 2015
Take common steps to fix the Kuma development environment. Basically the equivalent of resetting Firefox or unplugging a router. Restarts as much as possible without losing data.
View kuma-vagrant-reset.sh
#!/bin/bash
# Configuration
KUMA_ROOT=/path/to/kuma
# Script
# https://www.youtube.com/watch?v=ckIMuvumYrg
pushd .
cd $KUMA_ROOT
vagrant halt
You can’t perform that action at this time.