Skip to content

Instantly share code, notes, and snippets.


Justin Hammond Justintime50

View GitHub Profile
View slugify.js
function slugify(text)
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
caniszczyk /
Created Oct 9, 2012
Clone all repos from a GitHub organization
curl -s | ruby -rubygems -e 'require "json"; JSON.load( { |repo| %x[git clone #{repo["ssh_url"]} ]}'
jwebcat / gist:5122366
Last active Aug 3, 2021 — forked from lemenkov/gist:1674929
Properly download from github using wget and curl
View gist:5122366
wget --no-check-certificate --content-disposition
# --no-check-cerftificate was necessary for me to have wget not puke about https
curl -LJO
arunoda / gist:7790979
Last active Aug 3, 2021
Installing SSHPass
View gist:7790979

Installing SSHPASS

SSHPass is a tiny utility, which allows you to provide the ssh password without using the prompt. This will very helpful for scripting. SSHPass is not good to use in multi-user environment. If you use SSHPass on your development machine, it don't do anything evil.

Installing on Ubuntu

apt-get install sshpass

Installing on OS X

myusuf3 /
Created Nov 3, 2014
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
spalladino /
Created Dec 22, 2015
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

joncardasis /
Last active Jul 31, 2021
Storing Images and Demos in your Repo

Storing Images and Demos in your Repo

In this quick walkthough you'll learn how to create a separate branch in your repo to house your screenshots and demo gifs for use in your master's readme.

How to

1. Clone a fresh copy of your repo

In order to prevent any loss of work it is best to clone the repo in a separate location to complete this task.

2. Create a new branch

Create a new branch in your repo by using git checkout --orphan assets

evansde77 /
Last active Aug 1, 2021
Example of mocking requests calls
#!/usr/bin/env python
mocking requests calls
import mock
import unittest
import requests
from requests.exceptions import HTTPError
ammario / goth
Created Sep 2, 2016
golang test coverage html
View goth
go test -coverprofile=coverage.out
go tool cover -html=coverage.out