Skip to content

Instantly share code, notes, and snippets.

View callaginn's full-sized avatar
😎
Coding

Stephen Ginn callaginn

😎
Coding
View GitHub Profile
@callaginn
callaginn / dreamhost.js
Last active November 5, 2021 05:36
Fetch and Download Dreamhost Domain Info
/*/
Fetch Dreamhost Domain Info
The Dreamhost API command domain-list_domains was retired on Nov 2nd 2021. This function is a makeshift replacement for that.
Usage:
1. Log into your Dreamhost account and click Domains / Manage Domains
2. Paste this entire gist into the console
3. Press enter and wait for "sites.json" to be downloaded
Let me know if this helps anyone else or if you have any suggestions.
@bcnzer
bcnzer / postman-pre-request.js
Last active July 17, 2024 15:53
Postman pre-request script to automatically get a bearer token from Auth0 and save it for reuse
const echoPostRequest = {
url: 'https://<my url>.auth0.com/oauth/token',
method: 'POST',
header: 'Content-Type:application/json',
body: {
mode: 'application/json',
raw: JSON.stringify(
{
client_id:'<your client ID>',
client_secret:'<your client secret>',
@karlhillx
karlhillx / macos_high_sierra_apache_php_brew_2018.md
Last active June 10, 2024 14:37
macOS High Sierra Setup: Homebrew + Apache + PHP + MariaDB + SSL

macOS High Sierra Setup: Homebrew + Apache + PHP + MariaDB + SSL

Homebrew Installation

First let's install Homebrew.

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

@giovanigenerali
giovanigenerali / postfix-gmail-macos.md
Last active December 20, 2021 20:07
Postfix Gmail relay on macOS Sierra & macOSHigh Sierra

Postfix Gmail relay on macOS Sierra & macOSHigh Sierra

1 - Create a file to store our credentials:

sudo vim /etc/postfix/sasl_passwd

2 - Add something like this:

@jakerella
jakerella / jkq.js
Last active May 3, 2024 01:49
An ultra-light, jQuery-like micro-library for selecting DOM elements and manipulating them.
(function() {
'use strict';
/**
* Core method, similar to jQuery (only simpler)
*
* @param {String|HTMLElement} s The CSS selector to search for or HTML element to wrap with functionality
* @param {HTMLElement} root OPTIONAL An HTML element to start the element query from
* @return {Array} The collection of elements, wrapped with functionality (see API methods)
*/
@jeremypage
jeremypage / check-tls.js
Last active January 31, 2019 10:40
JavaScript: Check TLS level of browser and remove matching domain links from page if browser does not meet minimum requirement
// domains to check
var checkDomains = ['www.foobar.com', 'www.fubar.com'];
// check all links in DOM for matching domain(s)
var matchingLinks = [];
var documentLinks = document.links;
for (var i = 0; i < documentLinks.length; i++) {
if (checkDomains.indexOf(documentLinks[i].hostname) > -1)
matchingLinks.push(documentLinks[i]);
}
@chrisjhoughton
chrisjhoughton / enforce-http.liquid.js
Last active February 14, 2024 07:49
How to build an ajax form on Shopify. See http://inside.sauce.ly/how-to-build-an-ajax-login-form-on-shopify/ for the full blog post.
/*
* Ensure the http protocol is always used on the myshopify.com domains.
* Uses liquid to input the correct URL.
*/
if (window.location.href.match(/https:\/\/.*.myshopify.com/) && top === self) {
window.location.href = window.location.href.replace(/https:\/\/.*.myshopify.com/, 'http://{{ shop.domain }}');
}
@paulirish
paulirish / bling.js
Last active July 3, 2024 20:45
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@drmalex07
drmalex07 / getopt-example.sh
Last active May 3, 2024 03:03
A small example on Bash getopts. #bash #getopt #getopts
#!/bin/bash
#
# Example using getopt (vs builtin getopts) that can also handle long options.
# Another clean example can be found at:
# http://www.bahmanm.com/blogs/command-line-options-how-to-parse-in-bash-using-getopt
#
aflag=n
bflag=n
@ofca
ofca / $.3.js
Last active February 20, 2021 13:30
// based on https://gist.github.com/Potfur/5576225 & https://github.com/james2doyle/saltjs
// more info: https://plus.google.com/109231487156400680487/posts/63eZzzrBSb6
window.$ = function(s) {
var c = {
'#': 'ById',
'.': 'sByClassName',
'@': 'sByName',
'=': 'sByTagName'}[s[0]];
return document[c?'getElement'+c:'querySelectorAll'](s.slice(1))
};