Skip to content

Instantly share code, notes, and snippets.

View bjankord's full-sized avatar
🎵
Chillin'

Brett Jankord bjankord

🎵
Chillin'
View GitHub Profile
@hyperupcall
hyperupcall / change-master-branch-to-main.sh
Last active May 14, 2021 04:35
Cross-platform shell script to change the 'master' branch to 'main' for the local and remote repository
#!/bin/sh -eu
# code licensed under BSD 2-Clause "Simplified" License
# see `change-master-branch-to-main.sh --help` for usage
# see twitter thread for more details: https://twitter.com/EdwinKofler/status/1272729160620752898
site="github.com"
oldDefaultBranch="master"
newDefaultBranch="main"
@addisonschultz
addisonschultz / useScript.tsx
Last active October 28, 2023 10:02
A React hook that lets you add script tags to a component. Useful when needing to load scripts for components in Framer X.
import * as React from "react"
import { useState, useEffect } from "react"
// Hook
let cachedScripts = []
export function useScript(src) {
// Keeping track of script loaded and error state
const [state, setState] = useState({
loaded: false,
@gianpaj
gianpaj / extractCSS.js
Created March 25, 2019 09:52
Extract used CSS from a page
# Extract used CSS from a page
# https://stackoverflow.com/a/55334749/728287
#
# $ node extractCSS.js ~/Desktop/Coverage-20190325T110812.json
const fs = require('fs');
let final_css_bytes = '';
let total_bytes = 0;
let used_bytes = 0;
@andyl
andyl / extension.js
Last active December 13, 2018 11:25
const vscode = require('vscode');
const shelljs = require('shelljs');
// This extension is a hack to explore a possible VsCode way to search
// for a directory name.
//
// In IntelliJ you can search for a directory by ending the search string with '/'.
// In Vim, you can `:call fzf#run({'source': 'fd -t d', 'sink': 'NERDTreeFind'})`
//
// But VsCode doesn't seem to provide an API to open the current

Get all packages

Get all packages by running lerna ls. Convert this to an array Save array as a const named all.

Get updated packages

Get updated package by running lerna updated Convert this to an array Save array as a const named updated.

@tsukhu
tsukhu / Steps.md
Last active November 14, 2023 07:07
create-react-app with styled components

Here are the steps to convert the create-react-app generated to code to use styled components instead of css

  1. Created an app using create-react-app
create-react-app react-styledcomponents-app
  1. Install styled-components as a dependency
@bjankord
bjankord / find-and-replace-script.js
Last active July 12, 2019 11:19
Changelog find and replace script
#!/usr/bin/env node
/* eslint-disable no-console */
/* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */
const fs = require('fs');
const path = require('path');
const packagePaths = require('../peer-dependency-generator/getPackagePaths');
const findAndReplace = require('../peer-dependency-generator/findAndReplace');
// Generate the markdown to display peerDependencies information for each package
packagePaths.forEach((packagePath) => {
@DavidWells
DavidWells / css-with-react-checklist.md
Last active November 21, 2018 22:56
Lots of talk about different CSS solutions for React. This gist attempts to shed light on pros/cons of approaches.

Here is a checklist of all the things I need my CSS solution to handle.

I can explain any of the points. Leave a comment on the gist or tweet @DavidWells

Challenge: Take your favorite CSS solution and see how the checklist holds up.

  • Has ability Localize classes
  • Has ability to use global classes
  • Has ability to write raw CSS
  • Syntax highlighting and auto completion
@dceddia
dceddia / config-overrides.dev.js
Created December 6, 2016 21:12
Customize Create React App without ejecting
module.exports = function(config) {
// Generate sourcemaps
config.devtool = 'source-map';
// Compile i18n messages throughout the project into JSON files
config.module.loaders[0].query.plugins = [
["react-intl", {
"messagesDir": "./build/messages/"
}]
];
@Hendrixer
Hendrixer / editor.css
Last active March 3, 2024 14:29
VS code custom CSS for theme
.composite-title, .composite-title, .vs-dark .monaco-workbench>.activitybar>.content {
background-color: rgba(40, 44, 52, 1) !important;
}
.tabs-container, .tab, .tab.active, .title-actions, .tablist, .tabs-container, .tabs, .composite.title {
background-color: rgba(40, 44, 52, 1) !important;
}
.tab.active, .tab {
border-right: 0px !important;