Skip to content

Instantly share code, notes, and snippets.

View JamiesonRoberts's full-sized avatar
👋

Jamieson Roberts JamiesonRoberts

👋
View GitHub Profile
import 'core-js/es/array/from';
const stringCleaner = str => {
const sanitized = Array
.from(str)
.filter(char => /[\u0020-\u007e\u00a0-\u00ff\n\r]/.test(char))
.join('')
return {sanitized, hasBeenModified: (str.length > sanitized.length)}
}
@JamiesonRoberts
JamiesonRoberts / countries.html
Created March 31, 2020 19:49
Shopify All Country Select
<select>
<option disabled="disabled" selected="selected" value="---">---</option>
<option data-code="AF" value="Afghanistan">Afghanistan</option>
<option data-code="AX" value="Aland Islands">Åland Islands</option>
<option data-code="AL" value="Albania">Albania</option>
<option data-code="DZ" value="Algeria">Algeria</option>
<option data-code="AD" value="Andorra">Andorra</option>
<option data-code="AO" value="Angola">Angola</option>
<option data-code="AI" value="Anguilla">Anguilla</option>
<option data-code="AG" value="Antigua And Barbuda">Antigua &amp; Barbuda</option>
@JamiesonRoberts
JamiesonRoberts / performance.conf
Last active October 6, 2022 01:04
Apache Security Headers Setup for Serverpilot
Header set Connection keep-alive
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType image/svg+xml "access 1 month"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
$header_crop = ingenious_get_option('header_crop');
$header_crop_array = is_array($header_crop) ? $header_crop : array($header_crop);
$header_crop_value = !empty($header_crop_array) ? $header_crop_array : array('left_crop');
$header_left_crop = in_array( 'left_crop', $header_crop_value) ? true : false;
$header_right_crop = in_array( 'right_crop', $header_crop_value) ? true : false;
$header_center_crop = in_array( 'center_crop', $header_crop_value) ? true : false;
@JamiesonRoberts
JamiesonRoberts / .gitignore
Created October 8, 2018 17:32
Global Gitignore
### macOS ###
#############
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
a,
abbr,
acronym,
address,
applet,
article,
aside,
audio,
b,
big,
@JamiesonRoberts
JamiesonRoberts / .htaccess
Last active October 17, 2018 19:07
Serverpilot Apache customizations
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . index.php [L]
</IfModule>
@JamiesonRoberts
JamiesonRoberts / header-overrides.php
Last active April 22, 2019 09:56
Wordpress 4.7.x Head Cleanup Script
<?php
/**
* Created by jamiesonroberts
* Date: 2017-04-08
*/
/**
* Removes security vulnerabilities, extraneous styles and scripts,
* as well as related resource inclusions for Wordpress 4.7.x
*
@JamiesonRoberts
JamiesonRoberts / youtube.js
Last active August 29, 2015 14:26
Simple script to get the videos that are part of a playlist on youtube
var playlistID = 'PLmKbqjSZR8TaNjzkuwaFOqjQibUnS2w6u';
var youtubeKEY = '{YOUR-API-KEY-HERE}';
var playlistJSON;
// This needs to be revised/updated to remove the error for a depreciation
function playListGet(theUrl)
{
var xmlHttp = new XMLHttpRequest();
@JamiesonRoberts
JamiesonRoberts / SassMeister-input.scss
Created July 13, 2015 13:36
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
$browser-context: 16; // Default
@function em($pixels, $context: $browser-context) {
@return #{$pixels/$context}em;
}