Skip to content

Instantly share code, notes, and snippets.

View Kernix13's full-sized avatar
💭
Still looking for a job - but losing hope

Jim Kernicky Kernix13

💭
Still looking for a job - but losing hope
View GitHub Profile
@Kernix13
Kernix13 / terminal-commands.md
Created September 15, 2022 01:23 — forked from bradtraversy/terminal-commands.md
Common Terminal Commands

Common Terminal Commands

Key Commands & Navigation

Before we look at some common commands, I just want to note a few keyboard commands that are very helpful:

  • Up Arrow: Will show your last command
  • Down Arrow: Will show your next command
  • Tab: Will auto-complete your command
  • Ctrl + L: Will clear the screen
@Kernix13
Kernix13 / BlogTitleUrl.js
Created September 15, 2022 15:23
Convert blog title to URL slug (my first gist)
const blogTitle = "How to create a GitHub Gist";
const urlSlug = blogTitle.toLowerCase().split(" ").filter(word => word !== "").join("-");
@Kernix13
Kernix13 / SplitSortFilterStr.js
Last active September 16, 2022 21:04
JavaScript function to split, sort, and filter out repeats from a string
// Function to sort words then strip out repeats
// Used to get unique keywords from different web languages/tools I've used to get ideas for blog posts. I tend to have a lot of repeats...
const commaSeparated = "split, sort, and, filter, strings, separated, by, commas, with, no, repeats, repeats, repeats";
const spaceSeparated = "split sort and filter strings separated by spaces with no repeats repeats repeats";
let commaWords = [];
let spaceWords = [];
function splitStrings(str, separator, output) {
@Kernix13
Kernix13 / ssh.md
Created September 19, 2022 12:48 — forked from bradtraversy/ssh.md
SSH & DevOps Crash Course Snippets

SSH Cheat Sheet

This sheet goes along with this SSH YouTube tutorial

Login via SSH with password (LOCAL SERVER)

$ ssh brad@192.168.1.29

Create folder, file, install Apache (Just messing around)

$ mkdir test

$ cd test

@Kernix13
Kernix13 / hamburgerMenu.css
Last active November 22, 2022 13:30
Mobile first responsive hamburger menu
*, *::before, *::after {
box-sizing: border-box;
}
body {
padding: 0;
margin: 0;
}
header {
@Kernix13
Kernix13 / recent-posts-custom-query.php
Last active July 26, 2023 15:18
WordPress Recent Posts Custom Query
<!-- Add to a plugin or in front-page.php for a custom theme -->
<aside class="bgcolor4">
<div class="container">
<h3 class="custom-title"><?php esc_html_e('Latest Articles ', 'tower') ?></h3>
<div class="row">
<?php
$query = new WP_Query( [
'post__not_in' => get_option( 'sticky_posts'),
'post_type' => 'post',
@Kernix13
Kernix13 / recent-posts-category.php
Created July 26, 2023 15:21
WordPress Category Recent Posts
<!-- Add before endwhile in single.php or as a plugin -->
<aside class="bgcolor4">
<div class="container">
<h3 class="custom-title"><?php esc_html_e('Similar articles you may like... ', 'tower') ?></h3>
<div class="row">
<?php
$cats = wp_get_post_categories( get_the_ID(), ['fields'=>'ids',]);
$relatedPosts = get_posts(
@Kernix13
Kernix13 / functions.php
Created March 30, 2024 18:02
Google Analytics loaded via wp_print_scripts
/*
DELETE THIS COMMENT BLOCK
1. replace 'yourtheme' in yourtheme_google_print_scripts with your theme name
- it occurs twice in the code below
2. replace the URL below that ends with 'ABC123' with your URL
3. replace 'ABC123' argument below in the 'gtag' function
4. Paste all of the code to the bottom of your functions.php file in the child theme or custom theme
*/
function yourtheme_google_print_scripts() { ?>
<!-- Global site tag (gtag.js) - Google Analytics -->
@Kernix13
Kernix13 / isAdmin.js
Last active March 30, 2024 18:12
Check for server cookie
// Setting cookie for logged in admin
// run npm install cookie then:
// petadoption is the name of the cookie for this example
const cookie = require('cookie');
function isAdmin(event) {
const incomingCookie = cookie.parse(event.headers.cookie || '');
if (incomingCookie?.petadoption == 'apsodifugyhtjrkelwqzmxncbv0918273645') {
return true;
@Kernix13
Kernix13 / loginAttempt.js
Created March 30, 2024 18:14
Set server cookie
// npm install cookie
const cookie = require('cookie');
const handler = async (event) => {
const body = JSON.parse(event.body);
// pick a generic username and password for now
if (body.username == "some_name" && body.password == "some_password") {