Skip to content

Instantly share code, notes, and snippets.

@chancesmith
chancesmith / charts.ts
Created July 23, 2021 02:29
chart types
type StatType = {}
type BarType = {
label: string;
value: number;
};
type DetailType = {
key: string;
value: number;
@chancesmith
chancesmith / SelectField.tsx
Created February 28, 2020 11:48 — forked from hubgit/SelectField.tsx
Use react-select with Formik
import {FieldProps} from 'formik';
import React from 'react';
import Select, {OptionsType, ValueType} from 'react-select';
interface Option {
label: string;
value: string;
}
interface CustomSelectProps extends FieldProps {
@chancesmith
chancesmith / index.html
Created August 20, 2018 15:42
simple css spinner
<div class="spinner"></div>
@chancesmith
chancesmith / readme.md
Last active November 24, 2021 11:47
Wordpress Setup shell script

Setup Instructions

  • add wp-setup.sh to your home directory
  • in terminal $ chmod +x wp-setup.sh so we can execute this without admin permissions needed
  • add an alias in your terminal profile and source the profile...(see command in next step)
  • $ echo '\n\n alias wpsetup="~/wp-setup.sh"' >> ~/.zshrc && . ~/.zshrc

Usage

Now, when you are ready run $ wpsetup in the folder you want to setup Wordpress locally in.

@chancesmith
chancesmith / lazy-load-images.js
Created November 8, 2017 16:55
Lazy load images
// #1 using the spread operator get all our images with the class 'lazyload'
const imgElements = [...document.querySelectorAll('.adg-lazy-image')]
// IE browser support :(
var isIE;
(function() {
var ua = window.navigator.userAgent,
msie = ua.indexOf('MSIE '),
trident = ua.indexOf('Trident/')
@chancesmith
chancesmith / .hyper.js
Last active October 17, 2017 17:32
hyper terminal settings
// Future versions of Hyper may add additional config options,,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 18,
// font family with optional fallbacks
@chancesmith
chancesmith / animate.js
Created September 12, 2017 12:27
Animate elements in and out on scroll
// onScroll animation
$(function() {
var $window = $(window),
isTouch = Modernizr.touch;
if (isTouch) { $('.add-animation').addClass('animated'); }
$window.on('scroll', revealAnimation);
@chancesmith
chancesmith / main.js
Last active September 5, 2017 14:25
ToysRUs price drop percentage
// test page: https://www.toysrus.com/search?q=dyl01sep17%20creator
// just copy this code in the console on a page
// that has all items with a price drop
var items = document.getElementsByClassName('product-item')
//var prices = items.getElementsByClassName('product-price')
var collection = []
for (var i=0; i<items.length; i++) {
// get link of item
var productLink = items[i].href
var productName = items[i].getElementsByClassName('product-item__product-title')[0].textContent
@chancesmith
chancesmith / .zshrc
Last active February 13, 2018 20:56
ZSH profile
plugins=(git sublime cloudapp node npm osx extract z)
# User configuration
# Remap alt-left and alt-right to forward/backward word skips.
# via @waltz, https://gist.github.com/waltz/8658549
bindkey "^[^[[D" backward-word
bindkey "^[^[[C" forward-word
# export MANPATH="/usr/local/man:$MANPATH"
@chancesmith
chancesmith / readme.md
Last active March 21, 2018 19:07
Setup Mac Computer Guide for Website Developement