Skip to content

Instantly share code, notes, and snippets.

View YenHub's full-sized avatar
🎯
Focusing

Ian Gilkes YenHub

🎯
Focusing
View GitHub Profile
@YenHub
YenHub / readme.md
Created October 31, 2021 21:41
🎷 A jazzy git readme template 🎶🎼

Repo Welcome

         

@YenHub
YenHub / debounce.md
Created March 31, 2021 21:50
Vanilla Javascript Debounce

Vanilla Javascript Debounce

What is debounce?

This is a vanilla JS version of the infamous Debounce function.

Debounce allows you to delay calls to a function in order to prevent spamming.

A good example of it's application would be an event handler whose event could be fired in multiple time in quick succession.

This function can be used to support JavaScript for the BackOffice non-react pages.

@YenHub
YenHub / ngrok.md
Created March 31, 2021 21:49
Exposing your local environment for mobile testing | ngrok Setup

Exposing your local environment for mobile testing | ngrok Setup

This guide describes the setup process to expose your local (e.g. https://localhost:3000) to the outside web.

This is helpful, for example, when attempting to test and inspect local code changes on a mobile device.

Install

Visit ngrok's website, setup an account & grab the exe

@YenHub
YenHub / vmmem.md
Created March 31, 2021 21:42
Vmmem Eating All Your Memory??

Vmmem Eating All Your Memory??

Simples...

WORKAROUND:

Add the following alias to the tail of ~/.bashrc

# Edit .bashrc (Right click to paste, Ctrl+X to save)
@YenHub
YenHub / twoSum.md
Last active March 25, 2021 22:24
Leet Code | Two Sum Solution

LeetCode | TwoSum

Difficulty: ✅☑☑☑☑

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.

You may assume that each input would have exactly one solution, and you may not use the same element twice.

You can return the answer in any order.

@YenHub
YenHub / merge-sort.js
Created March 24, 2021 20:31
Javascript Merge Sort
// For each side of a set of arrays
const mergeArrays = (left, right) => {
// Iterate each 0th value moving the vaues into our sorted array
let sortVals = [];
while(left.length && right.length) {
(left[0] < right[0]) ? sortVals.push(left.shift()) : sortVals.push(right.shift());
}
// Return sorted array & anything leftover from either side
@YenHub
YenHub / luhns.c
Created March 17, 2021 18:21
Luhn's Algorithm in C
#include <stdio.h>
#include <cs50.h>
string cardType;
// Prompt for a valid card number
long getCardNumber(void)
{
long cardNumber;
cardNumber = get_long("Please enter the card number: ");
@YenHub
YenHub / Fix Local DNS Issues.md
Last active March 10, 2021 17:13
Temp Fix: DNS Issues, cannot access 'https://some-url.com'

Temporarily Resolve Local DNS Issues

This snippet describes a workaround which can help when you're having issues connecting to a particular resource.

This is of course a temporary work around, however, can certainly get you out of a muddle fast!

For example, if you're unable to get to the nuget host, this guide can help you resolve this (temporarily!)

You can confirm whether you're having DNS issues, if for example, other connectivity otherwise appears fine, and a particular URL or resource will not resolve.

@YenHub
YenHub / websql-example.html
Created July 3, 2020 08:14 — forked from benpoole/websql-example.html
Javascript & Web SQL example
<!DOCTYPE HTML>
<html>
<!--
@author Ben Poole, http://benpoole.com
Example HTML5 code for playing with the local WebKit (Opera too?) SQL database.
@see http://benpoole.com/weblog/201106222227
-->
<head>
<meta charset="UTF-8" />
<title>Winkles Of The World Unite!</title>
@YenHub
YenHub / hyper-v.bat
Last active February 12, 2020 19:35
Toggle Hyper-V
@Echo off
setlocal EnableDelayedExpansion
set 1=auto
set 2=off
set 3=exit
Echo/
echo " __ __ __ __ ";
echo " / | / | / | / | ";
echo " $$ | $$ | __ __ ______ ______ ______ $$ | $$ | ";
echo " $$ |__$$ |/ | / | / \ / \ / \ ______ $$ | $$ | ";