Skip to content

Instantly share code, notes, and snippets.

View chrisrowe's full-sized avatar
🚢
Shipping

Chris Rowe chrisrowe

🚢
Shipping
View GitHub Profile
@DavidKuennen
DavidKuennen / minimal-analytics-snippet.js
Last active May 3, 2024 12:55
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@croxton
croxton / critical-css-with-js.twig
Last active November 3, 2020 08:30
Inline critical CSS with JS (Craft CMS)
{% set _inline_css_block = block('_inline_css') %}
{% if _inline_css_block is not empty %}
<script>
(function() {
/*! loadCSS. [c]2017 Filament Group, Inc. MIT License */
!function(e){"use strict";var n=function(n,t,o){function i(e){return a.body?e():void setTimeout(function(){i(e)})}function r(){l.addEventListener&&l.removeEventListener("load",r),l.media=o||"all"}var d,a=e.document,l=a.createElement("link");if(t)d=t;else{var s=(a.body||a.getElementsByTagName("head")[0]).childNodes;d=s[s.length-1]}var f=a.styleSheets;l.rel="stylesheet",l.href=n,l.media="only x",i(function(){d.parentNode.insertBefore(l,t?d:d.nextSibling)});var u=function(e){for(var n=l.href,t=f.length;t--;)if(f[t].href===n)return e();setTimeout(function(){u(e)})};return l.addEventListener&&l.addEventListener("load",r),l.onloadcssdefined=u,u(r),l};"undefined"!=typeof exports?exports.loadCSS=n:e.loadCSS=n}("undefined"!=typeof global?global:this);
!function(t){"use strict";t.loadCSS||(t.loadCSS=function(){});var e=loadCSS.relpreload={
@levelsio
levelsio / btc-eth-dca-buy.php
Last active January 6, 2023 22:04
This script runs daily and "Dollar Cost Average"-buys $40 BTC and $10 ETH per day
<?
//
// [ BUY BTC & ETH DAILY ON BITSTAMP ]
// by @levelsio
//
// 2017-08-23
//
// 1) buy $40/day BTC
// 2) buy $10/day ETH
//
@nfourtythree
nfourtythree / Password Protect Serverpilot App.md
Last active December 10, 2020 17:20
Password Protect Serverpilot App

How to password protect your Serverpilot app

This is a quick (rough) guide on how to protect a Serverpilot pilot app with auth basic

1. SSH into your Serverpilot Server

ssh SERVERPILOTUSERNAME@your.server.ip.address

2. Create a htpasswd file in your app

@sindresorhus
sindresorhus / post-merge
Last active May 2, 2024 03:18
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@pjaspers
pjaspers / gist:7246746
Created October 31, 2013 09:24
Quick way to get a public key into your clipboard.
# Takes a Github Username and copies his/her public key
#
# ghkey pjaspers
#
function ghkey {
if (( $# < 1 ))
then echo "usage: ghkey <username>"; return 1; fi
curl -sL https://github.com/$1.keys | pbcopy
}
@max
max / gist:5708466
Created June 4, 2013 18:54
Flat UI Colors as Sass variables
// I needed flatuicolors.com as Sass variables...
// In your console, run:
$('.color').get().map(function(el) { return "$" + el.classList[1] + ": " + el.getAttribute('data-clipboard-text') + ';' }).join('\r\n');
// Output:
// $turquoise: #1abc9c;
// $emerland: #2ecc71;
// $peter-river: #3498db;
// $amethyst: #9b59b6;
// $wet-asphalt: #34495e;
@codeincontext
codeincontext / gist:4286762
Created December 14, 2012 16:37
Make terminal text purple when ssh'ed into a server
# in remote ~/.bashrc
if [ -n "$SSH_CLIENT" ]; then text=" ssh"
fi
export PS1='\[\e[0;35m\]\u@\h:\w${text}$\[\e[m\] '
# - Colour codes -
# Black 0;30
@tomdavies
tomdavies / deploy-production.rb
Created November 27, 2012 12:16
Deploying ExpressionEngine 2 with Capistrano
set :deploy_to, "/var/www/default"
set :branch, 'master'
#Remote DB info
set :dbuser, ""
set :dbname, ""
set :dbhost, ""
set :dbpass, ""
@malarkey
malarkey / Contract Killer 3.md
Last active May 13, 2024 13:18
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………