Skip to content

Instantly share code, notes, and snippets.

View BaileySimrell's full-sized avatar

Bailey Simrell BaileySimrell

View GitHub Profile
@BaileySimrell
BaileySimrell / tailwind-indicator.tsx
Last active September 21, 2024 17:36
This component is a useful tool for anyone working with Tailwind CSS, allowing you to easily see which responsive breakpoint is active without needing to open browser developer tools.
export function TailwindIndicator() {
if (process.env.NODE_ENV === 'production') return null
return (
<div className="fixed bottom-1 left-1 z-50 flex size-6 items-center justify-center rounded-full bg-gray-800 p-3 font-mono text-xs text-white">
<div className="block sm:hidden">xs</div>
<div className="hidden sm:block md:hidden">sm</div>
<div className="hidden md:block lg:hidden">md</div>
<div className="hidden lg:block xl:hidden">lg</div>
<div className="hidden xl:block 2xl:hidden">xl</div>
@BaileySimrell
BaileySimrell / chatgpt_custom_instructions.txt
Created April 7, 2024 18:50
A prompt for GPT that will avoid usage of the top 100 adjectives disproportionately used more frequently by AI.
Please avoid the usage of the following top 100 adjectives proven to be disproportionately used more frequently by AI:
- commendable
- versatile
- fresh
- profound
- fascinating
- intriguing
- prevalent
- proactive
import numpy as np
import matplotlib.pyplot as plt
import random
# Initialize variables
n_rows = 42
n_cols = 42
total_squares = n_rows * n_cols
half_squares = total_squares // 2
@BaileySimrell
BaileySimrell / alpaca_correlation_viz.py
Last active April 5, 2023 04:55
This script takes a list of hard-coded stock symbols, fetches historical bar data on them, and then creates a heatmap illustrating Pearson's correlation between various pairs.
# import libraries
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from dotenv import load_dotenv
from alpaca_trade_api import REST, TimeFrame
import plotly.graph_objects as go
import plotly.express as px
import os
from datetime import datetime, timedelta
@BaileySimrell
BaileySimrell / index.js
Created January 16, 2022 22:41
Retrieve local IP address with Node JS
'use strict';
const { networkInterfaces } = require('os');
const nets = networkInterfaces();
const results = Object.create(null); // Or just '{}', an empty object
for (const name of Object.keys(nets)) {
for (const net of nets[name]) {
// Skip over non-IPv4 and internal (i.e. 127.0.0.1) addresses
<!-- orgID -->
<script>
var orgID = ("9ac76");
var orgIDClasses = document.getElementsByClassName("org-id");
for (var i = 0; i < orgIDClasses.length; i++) {
orgIDClasses[i].innerHTML = (orgID);
}
</script>
<script>
MemberStack.onReady.then(function(member) {
// do things with the member object
console.log(member["id"])
console.log(member["email"])
console.log(member["first-name"])
console.log(member["last-name"])
// check if member is logged in
member.loggedIn // returns true or false
<!--Enable quick search via Isotope-->
<script src="https://npmcdn.com/[email protected]/dist/isotope.pkgd.js"></script>
<script>
// quick search regex
var qsRegex;
// init Isotope
var $grid = $('.w-dyn-items').isotope({
itemSelector: '.w-dyn-item',
@BaileySimrell
BaileySimrell / Webflow_GA_Event_Tracking.html
Created December 4, 2019 23:28
paste this code in the footer of your site's settings within Webflow to send event data to GA from Webflow attributes
<!-- Start of Google Analytics Event tracking code -->
<script>
$(document).ready(function() {
$(document).on('click', '[data-gatrack]', function(e) {
var $link = $(this);
var commaSeperatedEventData = $link.data('gatrack');
var eventParams = commaSeperatedEventData.split(',');
if (!eventParams) { return; }
@BaileySimrell
BaileySimrell / magical_JS_snippet.html
Last active December 4, 2019 23:29
paste in page footer code to replace attribute params dynamically with Webflow CMS data and then send to GA
<script>
// magical JS snippet
$(document).ready(function() {
$("[data-gatrack]").each(function(i,item){
var json = JSON.parse($(this).siblings("[ga-track-json]").find('script').text());
var attr = $(this).attr("data-gatrack");
var new_track = attr.replace('{0}',json.provider_name);
$(this).attr('data-gatrack', new_track);
});
});