Skip to content

Instantly share code, notes, and snippets.

View NichlasB's full-sized avatar

Nichlas Brandon NichlasB

View GitHub Profile
@NichlasB
NichlasB / smoothscrollanchors.js
Last active July 15, 2017 19:03
Smooth Scroll Anchors (w/ Fixed Mobile NavBars/Headers)
jQuery(document).ready(function($){
/* Smooth Scroll Anchor Links */
$(document).on('click', 'a[href*="#"]', function (e) {
e.preventDefault();
var target = this.hash;
var $target = $(target);
$('html, body').stop().animate({
@NichlasB
NichlasB / smoothscrollanchors-staticmobile.js
Last active July 15, 2017 19:04
Smooth Scroll Anchors (w/ Static Mobile NavBars/Headers)
jQuery(document).ready(function ($) {
var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
/* Smooth Scroll Anchor Links */
$(document).on('click', 'a[href*="#"]', function (e) {
e.preventDefault();
var target = this.hash;
var $target = $(target);
@NichlasB
NichlasB / obscure-login-error-messages.php
Last active June 22, 2017 21:44
Obscure WordPress Login Error Message
<?php
/* Copy the Content Below this line - DO NOT INCLUDE THE <?php ABOVE */
function cf_login_obscure() {
return "Something didn't work out right!";
}
add_filter( 'login_errors', 'cf_login_obscure' );
@NichlasB
NichlasB / google-analytics-tracking-template.php
Last active April 22, 2019 10:01
Template for adding Google Analytics tracking code to site's head.
<?php
/* Copy the Content Below this line - DO NOT INCLUDE THE <?php ABOVE */
/**
* Add Google Analytics tracking code
*/
function cf_google_analytics_tracking() { ?>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
@NichlasB
NichlasB / sftp-new-server.sh
Last active June 17, 2020 14:48
Shell Script for Setting Up SFTP Server with EasyEngine
#!/bin/bash
# WARNING: Only run this script once per server.
####
## Creating SFTP Users - Initial Setup for New Server
####
####
## Gist: https://gist.github.com/NichlasB/e938cddb7876fd74af09dc00ca537a2c
@NichlasB
NichlasB / sftp-new-user.sh
Last active June 17, 2020 14:48
Shell Script for Creating EasyEngine Server SFTP User
#!/bin/bash
# WARNING: This script must be run manually to create a new SFTP user. Remember to change the new user's password.
# NOTICE: Make sure first instance of PasswordAuthentication is set to "no" $ sudo nano /etc/ssh/sshd_config
# REQUIREMENT: Make sure bindfs is installed $ sudo apt-get -y install bindfs
####
## Gist: https://gist.github.com/NichlasB/9b9c79ff8e31f48ad19f652b71baf8f6
## Resource: https://easyengine.io/docs/chroot-sftp-easyengine/
## Resource: https://www.howtoforge.com/restricting-users-to-sftp-plus-setting-up-chrooted-ssh-sftp-debian-squeeze
@NichlasB
NichlasB / create-admin-user.php
Last active June 22, 2017 21:47
Create a new WordPress admin user via functions.php
<?php
/* Copy the Content Below this line - DO NOT INCLUDE THE <?php ABOVE */
// Add snippet to functions.php file
function cf_new_admin_account() {
$user = 'admin';
$pass = 'password';
@NichlasB
NichlasB / scrollbar-styling.css
Created April 6, 2017 12:37
Customize the Browser Scrollbar
/** BROWSER SCROLLBAR **/
/* Scrollbar Styling */
::-webkit-scrollbar {
width: 11px;
}
/* The new scrollbar will have a flat appearance with the set background color */
::-webkit-scrollbar-track {
background-color: #FFD600;
@NichlasB
NichlasB / password-reset-link-duration.php
Last active June 22, 2017 21:53
Set Duration for Password Reset Link
@NichlasB
NichlasB / exclude-blog-categories.php
Last active June 22, 2017 21:56
Exclude Categories from WordPress Blog Page
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* exclude-blog-categories.php
*/
function cf_exclude_chosen_categories( $query ) {