Skip to content

Instantly share code, notes, and snippets.

@jsmeltzer
jsmeltzer / custom-select-arrow.css
Created August 14, 2020 13:31
Replace bootstrap custom select arrow
.custom-select {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='255' height='255'%3E%3Cpath d='M0 63.75l127.5 127.5L255 63.75z'/%3E%3C/svg%3E");
}
@jsmeltzer
jsmeltzer / style.css
Created August 9, 2020 15:58
Shockwave hover animation
button {
position: relative;
outline: 1px solid transparent;
border-radius: 50%;
border: 1px solid #bdc3c7;
width: 80px;
height: 80px;
background: none;
user-select: none;
}
@jsmeltzer
jsmeltzer / randomInteger.js
Created February 22, 2020 14:37
Returns an integer random number between min (included) and max (included):
function randomInteger(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
@jsmeltzer
jsmeltzer / scroll-to-anchor.js
Created June 13, 2017 20:31
Simple Scroll to Anchor using jQuery
// REF https://stackoverflow.com/questions/3163615/how-to-scroll-html-page-to-given-anchor-using-jquery-or-javascript
jQuery(document).ready(function($){
$(document).on('click', 'a.scroll-to', function(e) {
e.preventDefault();
scrollToAnchor( $(this).attr('href') );
});
});
function scrollToAnchor(aid){
var aTag = jQuery(aid);
@jsmeltzer
jsmeltzer / functions.php
Created June 8, 2017 14:57
Add new WordPress user via FTP
<?php
//REF http://www.wpbeginner.com/wp-tutorials/how-to-add-an-admin-user-in-wordpress-using-ftp/
function wpb_admin_account(){
$user = 'Username';
$pass = 'Password';
$email = 'email@domain.com';
if ( !username_exists( $user ) && !email_exists( $email ) ) {
$user_id = wp_create_user( $user, $pass, $email );
$user = new WP_User( $user_id );
$user->set_role( 'administrator' );
.aligner {
display: flex;
align-items: center;
}
.aligner-center {
display: flex;
align-items: center;
justify-content: center;
}
@jsmeltzer
jsmeltzer / style.css
Last active December 20, 2016 17:51
CSS Blur Content
body.spam table[data-restricted="true"] {
-webkit-filter: blur(0.8px);
filter: blur(0.8px);
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50) progid:DXImageTransform.Microsoft.Blur(PixelRadius='0.8');
opacity: 0.5;
}
@jsmeltzer
jsmeltzer / speedTest.js
Created June 24, 2015 01:54
JavaScript Speed Test Class From Code School
/*
Speed Test Class
Tests a code block X number of times and returns an average of the execution time
https://www.codeschool.com/courses/javascript-best-practices
*/
var SpeedTest = function(testImplement,testParams,repetitions){
this.testImplement = testImplement;
this.testParams = testParams;
@jsmeltzer
jsmeltzer / 0_reuse_code.js
Created June 4, 2014 20:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console