Skip to content

Instantly share code, notes, and snippets.

View ajmeese7's full-sized avatar
turning caffeine into code

Aaron Meese ajmeese7

turning caffeine into code
View GitHub Profile
@ajmeese7
ajmeese7 / info.md
Created April 19, 2018 18:47
Unsubscribe from Node.js organization updates

When you accept membership into the Node.js organization, you are automatically subscribed to notifications on multiple channels. If you're like me, you don't care all that much about what's going on in every repository.

To unsubscribe from these notifications, go to https://github.com/watching and click the button next to all the Node.js repositories you don't want updates from. Cheers!

@ajmeese7
ajmeese7 / spacing.md
Created May 20, 2018 17:11
Fix Atom file count icon spacing

In Atom, the file icon next to the file count in the lower right corner is much too close to the numbers to be attractive.

I fixed this by editing my Atom styles.less file by adding:

a.github-ChangedFilesCount.inline-block span {
  margin-right: 2.75px;
}

To edit the file, click alt and it'll be under the File buttom at the top left of the screen.

@ajmeese7
ajmeese7 / toggle.js
Created June 23, 2019 23:35
Toggle class in vanilla JS
// This is a general function that removes one class and adds another
function toggleClass(target, addedClass) {
// If target is an element rather than a list, it is converted to array form
if (!NodeList.prototype.isPrototypeOf(target)) {
target = [target];
}
// Allows for multiple elements to be toggled, such as by using the querySelectorAll() method
[].forEach.call(target, (element) => {
if (element.classList.contains(addedClass)) {
@ajmeese7
ajmeese7 / border.md
Created August 31, 2019 19:20
Cool top border

On the npm website, there is a neat looking border above the nav that is styled with the following code:

border-width: 3px 0 0;
border-top-style: solid;
border-image: linear-gradient(139deg, #fb8817, #ff4b01, #c12127, #e02aff) 3;
@ajmeese7
ajmeese7 / dynamicElementListener.js
Created February 3, 2020 20:10
Add listeners to dynamically added elements with jQuery
// Allows listener to apply to dynamically added elements
$("body").unbind().click(function() {
if (event) {
var target = event.target;
if (target.className === 'exampleClass' ||
target.parentElement.className === 'exampleClass')
{
doSomethingToElement();
}
}
@ajmeese7
ajmeese7 / printLocalStorage.js
Created April 9, 2020 19:25
I'm always needing to do this, so now I can find it easily
var keys = Object.keys(localStorage), i = 0, key;
for (; key = keys[i]; i++) {
console.log( key + '=' + localStorage.getItem(key));
}
@ajmeese7
ajmeese7 / darkMode.css
Created August 6, 2020 12:10
Shortest dark mode in CSS
/* https://dev.to/akhilarjun/one-line-dark-mode-using-css-24li */
html[theme='dark-mode'] {
/* Inverse the colors of all HTML elements */
filter: invert(1) hue-rotate(180deg);
}
html[theme='dark-mode'] img {
/* Inverse the images back to normal */
filter: invert(1) hue-rotate(180deg);
}
@ajmeese7
ajmeese7 / glitch-effect.css
Last active May 4, 2021 13:26
The glitch button effect from cyberpunk.net
body {
background-color: #f0e702;
}
.btn-preorder:hover .btn-preorder--glitch,
.btn-preorder:hover .btn-preorder__text:after {
display: block;
-webkit-animation-duration: 2s;
animation-duration: 2s;
-webkit-animation-timing-function: linear;

Keybase proof

I hereby claim:

  • I am ajmeese7 on github.
  • I am ajmeese7 (https://keybase.io/ajmeese7) on keybase.
  • I have a public key ASCBYacYo9geS14d88Hv0dxuWLh6nuPu5ZQPYTKemTKKhQo

To claim this, I am signing this object:

/*
Please write a function that adds two large numbers represented by a string , such that the output is not expressed in scientific notation.
*/
function add(a, b) {
let aNums = breakIntoManageableParts(a);
let bNums = breakIntoManageableParts(b);
let remainder = 0, bigSum = "";
while (aNums.length > 0 || bNums.length > 0) {