Skip to content

Instantly share code, notes, and snippets.

View cyancey76's full-sized avatar
🏠
Working from home

CJ Yancey cyancey76

🏠
Working from home
View GitHub Profile
@cyancey76
cyancey76 / fade-siblings.css
Last active April 26, 2019 21:25
CSS fade out sibling elements
.parent-element {
pointer-events: none;
}
.parent-element > * {
pointer-events: auto;
transition: 300ms opacity, 300ms transform;
}
.parent-element:hover > .sibling-elements,
@cyancey76
cyancey76 / remove-duplicate-array.js
Created March 16, 2019 07:51
ES6 remove duplicate array values
uniq = [...new Set(array)];
@cyancey76
cyancey76 / chatnums.js
Last active December 5, 2018 22:06 — forked from mxew/chatNumberThing.js
Chat numbers for #indiediscotheque
var chatsolab = 1;
$("#chat-txt-message").bind("keyup", function() {
var start = this.selectionStart;
var lastChar = String.fromCharCode(this.value.charCodeAt(start - 1));
if( lastChar == "@" ) {
$("#chat-txt-message").val("@");
} else if( lastChar == "!" ) {
$("#chat-txt-message").val("!");
} else if( event.which == 13 ) {
@cyancey76
cyancey76 / unselectable-text.css
Created September 28, 2018 05:05
Unselectable text
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
@cyancey76
cyancey76 / phone-regex.js
Last active December 5, 2018 21:58
Javascript #phone number #regex
var phoneRegex = "^\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$";
@cyancey76
cyancey76 / numbers-list.php
Created February 16, 2018 21:35
Output a list of numbers for copy/pasting into queries or whatever.
$startNumber = 1;
$endNumber = 250;
for( $i=$startNumber; $i <= $endNumber; $i++ ) {
echo $i . '<br/>';
}
@cyancey76
cyancey76 / functions.php
Last active December 5, 2018 22:18
#Wordpress #function - don't remove html tags
function tinymce_fix( $init )
{
$init['extended_valid_elements'] = 'section[*], article[*], div[*], span[*]';
$init['remove_linebreaks'] = false;
$init['convert_newlines_to_brs'] = true;
$init['remove_redundant_brs'] = false;
return $init;
}
add_filter('tiny_mce_before_init', 'tiny_mce_fix');
@cyancey76
cyancey76 / replace-accents.php
Created October 2, 2017 17:32
Replace accented characters
function removeAccents($str) {
$a = array('À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', 'Ā', 'ā', 'Ă', 'ă', 'Ą', 'ą', 'Ć', 'ć', 'Ĉ', 'ĉ', 'Ċ', 'ċ', 'Č', 'č', 'Ď', 'ď', 'Đ', 'đ', 'Ē', 'ē', 'Ĕ', 'ĕ', 'Ė', 'ė', 'Ę', 'ę', 'Ě', 'ě', 'Ĝ', 'ĝ', 'Ğ', 'ğ', 'Ġ', 'ġ', 'Ģ', 'ģ', 'Ĥ', 'ĥ', 'Ħ', 'ħ', 'Ĩ', 'ĩ', 'Ī', 'ī', 'Ĭ', 'ĭ', 'Į', 'į', 'İ', 'ı', 'IJ', 'ij', 'Ĵ', 'ĵ', 'Ķ', 'ķ', 'Ĺ', 'ĺ', 'Ļ', 'ļ', 'Ľ', 'ľ', 'Ŀ', 'ŀ', 'Ł', 'ł', 'Ń', 'ń', 'Ņ', 'ņ', 'Ň', 'ň', 'ʼn', 'Ō', 'ō', 'Ŏ', 'ŏ', 'Ő', 'ő', 'Œ', 'œ', 'Ŕ', 'ŕ', 'Ŗ', 'ŗ', 'Ř', 'ř', 'Ś', 'ś', 'Ŝ', 'ŝ', 'Ş', 'ş', 'Š', 'š', 'Ţ', 'ţ', 'Ť', 'ť', 'Ŧ', 'ŧ', 'Ũ', 'ũ', 'Ū', 'ū', 'Ŭ', 'ŭ', 'Ů', 'ů', 'Ű', 'ű', 'Ų', 'ų', 'Ŵ', 'ŵ', 'Ŷ', 'ŷ', 'Ÿ', 'Ź', 'ź', 'Ż', 'ż', 'Ž', 'ž', 'ſ', 'ƒ', 'Ơ', 'ơ', 'Ư', 'ư', 'Ǎ', 'ǎ', 'Ǐ', 'ǐ', 'Ǒ', 'ǒ', 'Ǔ',
@cyancey76
cyancey76 / .htaccess
Created September 25, 2017 17:49
.htaccess force SSL
# FORCE SSL
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# FORCE SSL for load balancer
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
@cyancey76
cyancey76 / .htaccess
Last active September 19, 2019 16:51
.htaccess password protect #htaccess
AuthType Basic
AuthName "Password Protected Area"
AuthUserFile /path/to/.htpasswd
Require valid-user