Skip to content

Instantly share code, notes, and snippets.

View egstad's full-sized avatar

Jordan Egstad egstad

View GitHub Profile
@egstad
egstad / github-shop-ascii.js
Last active February 26, 2025 14:54
GitHub Shop: ASCII Effect
// __ ___ ___ ____ ____ ___ __ _ _ _ _ __ ___
// /__\ / __)/ __(_ _(_ _) / __) /__\ ( \( ( \/ /__\ / __)
// /(__)\\__ ( (__ _)(_ _)(_ ( (__ /(__)\ ) ( \ /(__)\\__ \
// (__)(__(___/\___(____(____) \___(__)(__(_)\_) \(__)(__(___/
// What you'll need...
// 1. A canvas: <canvas id="asciiCanvas"></canvas>
// 2. An image: <img id="image" src="" alt="">
// Fetch elements
@egstad
egstad / lazy.js
Created May 20, 2019 22:44
NUXT + Vanilla-lazyload
import LazyLoad from "vanilla-lazyload";
import utils from "./utils";
/* ==========================================================================
LAZYLOAD
==========================================================================
Once an element enters viewport, load it up!
Handles lazyloading images, iframes, scripts, etc...
https://github.com/verlok/lazyload
@egstad
egstad / animate.js
Created May 20, 2019 18:58
Animation
import dom from "./dom"
import utils from "./utils"
/* ==========================================================================
ANIMATE
==========================================================================
When ".js-animate" elements are in view, ".is-active" class is added.
Intersection Observer for modern browsers
Scroll event fallback for browsers that don't support Intersection Ob.
@egstad
egstad / breaktext.js
Last active February 11, 2019 19:58
Add line break in text (Javascript Class)
class BreakText {
constructor ( element, splitAfter ) {
this.element = document.querySelector( element );
this.stringOriginal = this.element.textContent;
this.stringNew = this.stringOriginal.replace( splitAfter, `${splitAfter}\u000A` );
this.element.innerText = this.stringNew;
}
}
// How to init
@egstad
egstad / tada68.md
Last active November 13, 2022 18:20
Update TADA68

Tada68 Remapping on Mac

Wanna remap your TADA68? Of course you do, especially if you're like me and use a Mac.


STEP 1 — Visit the editor

Click here to visit the site. This website is a piece of absolute horse shit. Enable flash and prepare yourself. View the notes section of this doc for some helpers. Once you're pleased with the layout, compile and save it into your Downloads folder. Name it FLASH.BIN (all caps).

'use strict';
export const colors = {
'red': {
'dark': true,
'colors': ['d50000']
},
'redViolet': {
'dark': true,
'colors': ['c51162']
// Viewport sizes
$vp1 : 40em;
$vp2 : 60em;
@mixin breakpoint($min:$vp1, $max:null) {
// for max-width
@if $min == max {
@media (max-width: $max) { @content; }
}
@egstad
egstad / cursor_background-change.js
Created May 11, 2015 20:37
Changing background color based on cursor position
// background color change according to cursor position
$(document).mousemove(function (e) {
var $width = ($(document).width()) / 255;
var $height = ($(document).height()) / 255;
var $pageX = parseInt(e.pageX / $width, 10);
var $pageY = parseInt(e.pageY / $height, 10);
// rgba($a-$b-$c);
var $a = $pageX,
@egstad
egstad / wp-rss-hooks.md
Last active July 1, 2017 08:30
Wordpress RSS Hooks

rss2_ns - allows to add new namespaces inside the root XML element;

rss2_head - allows to add to add tags in the feed header;

the_content_feed - allows to modify the content of each Post displayed in the Feed;

rss2_item - allows to add new sub-elements to each (Post) element;

@egstad
egstad / post-tags-in-search.php
Last active August 29, 2015 14:20
Wordpress: Include Post Tags within Search
<?php // don't include the php tag
function custom_search_where($where){
global $wpdb;
if (is_search())
$where .= "OR (t.name LIKE '%".get_search_query()."%' AND {$wpdb->posts}.post_status = 'publish')";
return $where;
}
function custom_search_join($join){