Skip to content

Instantly share code, notes, and snippets.

View rewdy's full-sized avatar

Andrew Meyer rewdy

View GitHub Profile
@rewdy
rewdy / grid.scss
Last active March 17, 2024 20:37
Copy/paste-able SCSS flex box grid
// FYI, there's a high chance this was stolen from Bootstrap initially. There are a few minor changes.
$grid-columns: 12;
$grid-gutter: 40px;
$grid-breakpoints: (
xs: 0,
sm: 576px,
md: 768px,
lg: 992px,
xl: 1200px,
@rewdy
rewdy / typescript.md
Last active July 10, 2023 16:42
Typescript quick reference

Typescript quick reference

When I started writing TypeScript, I didn't have much of any experience with strongly typed languages. For that reason, it was a bit of a sharp learning curve. Especially, when I was used to JS that just lets you do whatever the heck you want. This is a very basic intro that would have been helpful for me when I started. Hopefully, it's helpful to someone else out there.

Typing variables

This is generally pretty straightforward and easy to read:

const thing: string = "asdf";
@rewdy
rewdy / git-revert-to
Created March 16, 2023 16:08
git-revert-to command
git-revert-to() {
if [ -z "$1" ]; then
echo "⚠️ Pls specify a commit hash to revert to"
else
git diff HEAD "$1" | git apply
fi
}
@rewdy
rewdy / git-revert-to.sh
Last active October 14, 2022 15:18
Git revert back to a specific commit hash
# Reverting a single commit isn't too hard with git,
# but if you have a series of commits you want to revert
# it isn't always totally clear how to to it. This
# is what I use:
git diff HEAD <commit_hash_to_go_to> | git apply
@rewdy
rewdy / toCrazyCase.js
Created December 27, 2021 02:46
Crazy case function
// You probably need this. 😂
// Extend JS String object
String.prototype.toCrazyCase = function () {
return this.split("").map((l) => {
const upper = Boolean(Math.round(Math.random()));
return upper ? l.toUpperCase() : l.toLowerCase()
}).join("");
};
@rewdy
rewdy / objectSort.js
Created December 24, 2021 17:01
js object sort by property
const arrayOfObjects = [
{
color: "red",
hex: "#f00",
},
{
color: "orange",
hex: "#f60",
},
{
@rewdy
rewdy / .zshrc
Created March 16, 2020 19:45
My starting .zshrc
# Add all PATH stuff here...
# Path to your oh-my-zsh installation.
# export ZSH=/Users/USERNAME/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
# ZSH_THEME="robbyrussell"
ZSH_THEME="af-magic"
@rewdy
rewdy / includes.js
Created November 3, 2016 20:28
Ultra basic JS-powered includes
/**
* @file
* JS-powered includes
* Super basic, mostly helpful for mock ups
*
* Add a `data-include="source-of-content.html"` to any element. This script will pull in
* the content from the source and make it the elements content.
*/
$(function(){
// data-includes
@rewdy
rewdy / Page Reloader
Created July 25, 2013 20:28
Here's a little jQuery-dependant javascript that will reload the page at regular intervals. To be used when writing css or other code for the page to preview while you're working. To make it work, include jQuery, this snippet, and then add #!refresh to the end of the URL. Voila!
<script>
$(function(){
// reload if #!refresh is appended to url.
if (location.href.indexOf('#!refresh')>=0) {
timer = setTimeout(function(){
location.reload(true);
}, 3000);
}
});
</script>
@rewdy
rewdy / Mapilicious-init-w-options.html
Created March 21, 2013 22:35
Mapilicious - Initiate with options
<script>
$().mapilicious({
placement: 'after',
linkText: 'View a map'
});
</script>