Skip to content

Instantly share code, notes, and snippets.

View jasonadkison's full-sized avatar

Jason Adkison jasonadkison

  • Shoe Carnival
  • Evansville, IN
View GitHub Profile
@jasonadkison
jasonadkison / rebase.md
Created August 4, 2023 20:48
Rebase a commit
  1. Open Visual Studio Code (VSCode) and navigate to the repository you want to work with.

  2. Make sure you are on the branch that contains the commit you want to edit. You can use git checkout <branch-name> to switch to the desired branch.

  3. Find the commit hash of the commit you want to edit by using git log.

  4. Start an interactive rebase using the following command:

    git rebase -i <commit-hash>^
    
@jasonadkison
jasonadkison / useOnlyIfMountedCallback.ts
Created October 13, 2021 19:15
Run a callback function only if the component is still mounted.
import { useCallback, useEffect, useRef } from 'react';
const useOnlyIfMountedCallback = (): ((fn: () => void) => void) => {
const didUnmountRef = useRef(false);
const onlyIfMountedCallback = useCallback((fn) => {
if (didUnmountRef.current) {
return;
}
@jasonadkison
jasonadkison / account page curl - local versus staging
Last active May 4, 2020 18:10
troubleshooting account pages
$ curl -I http://localhost:8080/account
HTTP/1.1 302 REDIRECT
accept-ranges: bytes
x-dw-request-base-id: aHjiUI0vsF6MAAAK
location: https://staging-ecom-shoecarnival.demandware.net/s/shoecarnival/myaccount?original=%2Fs%2Fshoecarnival%2Faccount
content-type: text/html;charset=UTF-8
content-length: 0
date: Mon, 04 May 2020 15:06:53 GMT
connection: close
server: Apache
@jasonadkison
jasonadkison / cleanup-dokku-tag.sh
Created February 16, 2020 16:09
Dokku tag deploy cleanup script - destroys older dokku tags automatically to prevent excessive storage costs
#!/bin/bash
# This script ensures we don't have excess tags hanging around after image deployment by destroying any tag older than 'previous'
if [ -z "$1" ]
then
echo "ERROR! The dokku app name must be passed as an argument."
exit 1
fi
DOKKU_APP=$1
@jasonadkison
jasonadkison / undefined.js
Last active October 10, 2019 16:00
undefined.js
function throwIt() {
callSomeUndefinedFunction();
}
alert();
@jasonadkison
jasonadkison / rails_helper.rb
Created April 1, 2019 14:29
selenium, headless chrome, capybara, loggingPrefs
require 'capybara/rails'
require 'webdrivers'
default_driver = :chrome_headless
Capybara.register_driver default_driver do |app|
options = Selenium::WebDriver::Chrome::Options.new
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
@jasonadkison
jasonadkison / attach_ebs_volume.sh
Created December 6, 2018 22:41
Attach EBS volume
#!/bin/bash
# attach the EBS drive from the console to /dev/sdf
# list the volumes
lsblk
# check if the volume has any data
sudo file -s /dev/xvdf
"result": {
"user": {
"username": "anthonyb__99",
"full_name": "Anthony Busciglio",
"is_private": false,
"about": "Entrepreneur. Fun guy. House music. Fit life. Young at heart. Go big or go home",
"photo_url": "https://hypeauditor.com/uploads/h/5/6/9/3dc474fb7559703336b5b36784af0886.jpg?p=fczNAO9t1MDFeTFZwuYadTmaDNt%2FuRvBL8YIp%2Bu3lTJT4MCNfkjuHWI9fasdd0K3%2FnFTqWZjSjvMnRdsJjxPACHKEgvhNhtgHmFc8tSJEOGZoxBNemBgbLbwcxOwO28qgAzNCY3ZZ3XAwGoPoxvLtiiNL0axm3N8lBnCjwL5siMOHwQwbjV%2FuUSTNdi2OFwM1qHC3cRF%2BroJ2cOFK6xiGA%3D%3D",
"posts_count": 364,
"followers_count": 1222,
function getCookie(t){if(!document.cookie)return null;const e=document.cookie.split(";").map(t=>t.trim()).filter(e=>e.startsWith(t+"="));return 0===e.length?null:decodeURIComponent(e[0].split("=")[1])}
function md5(n,r,t){function e(n,r){var t=(65535&n)+(65535&r);return(n>>16)+(r>>16)+(t>>16)<<16|65535&t}function o(n,r,t,o,u,c){return e((f=e(e(r,n),e(o,c)))<<(a=u)|f>>>32-a,t);var f,a}function u(n,r,t,e,u,c,f){return o(r&t|~r&e,n,r,u,c,f)}function c(n,r,t,e,u,c,f){return o(r&e|t&~e,n,r,u,c,f)}function f(n,r,t,e,u,c,f){return o(r^t^e,n,r,u,c,f)}function a(n,r,t,e,u,c,f){return o(t^(r|~e),n,r,u,c,f)}function i(n,r){var t,o,i,h,v;n[r>>5]|=128<<r%32,n[14+(r+64>>>9<<4)]=r;var g=1732584193,l=-271733879,d=-1732584194,C=271733878;for(t=0;t<n.length;t+=16)o=g,i=l,h=d,v=C,l=a(l=a(l=a(l=a(l=f(l=f(l=f(l=f(l=c(l=c(l=c(l=c(l=u(l=u(l=u(l=u(l,d=u(d,C=u(C,g=u(g,l,d,C,n[t],7,-680876936),l,d,n[t+1],12,-389564586),g,l,n[t+2],17,606105819),C,g,n[t+3],22,-1044525330),d=u(d,C=u(C,g=u(g,l,d,C,n[t+4],7,-176418897),l,d,n[t+5],12,1200080426),g,l,n[t+6],17,-1473231341),C,g,n[t+7],22,-45705983),d=u(d,C=u(C,g=u(g,l,d,C,n[t+8],7,1770035416),l,d,n[t+9],12,-1958414417),g,l,n[t+10],17,-42063),C,g,n[t+11],22,-1990404162),d=u(d,C=u(C,g=u(g,l,d