Skip to content

Instantly share code, notes, and snippets.

View surdaft's full-sized avatar
🤓

SurDaft - Jack Stupple surdaft

🤓
View GitHub Profile
@surdaft
surdaft / links.txt
Last active November 23, 2020 11:38
Common Twitch Spam URLs
@surdaft
surdaft / serverCodes.md
Created April 18, 2019 09:39 — forked from sgnl/serverCodes.md
status codes

1xx: Information

Code Message Description
100 Continue The server has received the request headers, and the client should proceed to send the request body
101 Switching Protocols The requester has asked the server to switch protocols
103 Checkpoint Used in the resumable requests proposal to resume aborted PUT or POST requests

2xx: Successful

Code Message Description
@surdaft
surdaft / script.js
Created April 22, 2018 12:47
For Above Infinity ECO event
(function() {
let newElement = document.createElement('div');
newElement.innerHTML = `<div><div class="bar-container">
<div class="progress-bar-outer">
<div class="progress-bar-inner">
<span class="progress" id="output" data-goal="0">£0 / £500 (0.00%)</span>
</div>
</div>
</div>
<?php
/**
* Hide recaptcha column after contact-form-submissions has determined the columns for that form.
*/
add_action('manage_wpcf7s_posts_columns', function($columns) {
if (in_array('g-recaptcha-response', $columns)) {
unset($columns[array_search('g-recaptcha-response', $columns)]);
}
@surdaft
surdaft / serve-wordpress-theblueskitchen.sh
Last active October 20, 2017 10:22
Nginx configurations for Homestead
#!/usr/bin/env bash
declare -A params=$6 # Create an associative array
paramsTXT=""
if [ -n "$6" ]; then
for element in "${!params[@]}"
do
paramsTXT="${paramsTXT}
fastcgi_param ${element} ${params[$element]};"
done
fi
@surdaft
surdaft / whichTransition.js
Created September 8, 2017 13:40
Transition end stuff
function whichTransitionEvent() {
var t,
$e = document.createElement('whatever'),
transitions = {
'transition': 'transitionend',
'OTransition': 'oTransitionEnd',
'MozTransition': 'transitionend',
'WebkitTransition': 'webkitTransitionEnd'
};
<?php
function humanize_filesize($size, $precision = 0) {
if ($size !== 0) {
$base = log($size) / log(1024);
$units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
$size = round(pow(1024, $base - floor($base)), $precision);
$unit = $units[floor($base)];
} else {
$unit = 'B';
@surdaft
surdaft / addEventListener-polyfill.js
Created August 7, 2017 09:47
Add Event Listener
// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
(function() {
if (!Event.prototype.preventDefault) {
Event.prototype.preventDefault=function() {
this.returnValue=false;
};
}
if (!Event.prototype.stopPropagation) {
Event.prototype.stopPropagation=function() {
this.cancelBubble=true;
@surdaft
surdaft / nav.php
Created June 6, 2017 08:23
Get primary nav with nav container
<?= wp_nav_menu([
'menu' => 'primary_nav',
'container' => 'nav',
'container_class' => 'primary-nav',
'item_spacing' => 'discard'
]); ?>
@surdaft
surdaft / bootstrap_config.json
Last active August 7, 2017 11:47 — forked from anonymous/config.json
Bootstrap Customizer Config
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(#428bca, 6.5%)",
"@brand-success": "#5cb85c",