Skip to content

Instantly share code, notes, and snippets.

@chaseholdren
chaseholdren / nvmish
Created May 14, 2024 05:21 — forked from assaf/nvmish
nvm use <package.json>
#!/usr/bin/env bash
#
# Run nvmish in your current project directory to use the version of io.js/Node
# as specified in package.json. It will also install that version, if not
# already installed.
#
# If package.json specifies engines.iojs, uses the corresponding version of
# io.js, otherwise, if package.json specifies engines.node, uses the
# corresponding version of Node.js.
#
@chaseholdren
chaseholdren / theme.json
Last active January 31, 2024 22:49
oh-my-posh theme
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"console_title_template": "{{.UserName}}@{{.HostName}} in {{.PWD}}",
"blocks": [
{
"alignment": "left",
"newline": true,
"segments": [
{
"foreground": "#E06C75",
@chaseholdren
chaseholdren / InstallPackages.ps1
Last active January 2, 2021 03:08
fresh OS install
# WSL
choco install -y Microsoft-Windows-Subsystem-Linux --source="'windowsfeatures'"
Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1804 -OutFile ~/Ubuntu.appx -UseBasicParsing
Add-AppxPackage -Path ~/Ubuntu.appx
# run the distro once and have it install locally with root user, unset password
RefreshEnv
Ubuntu1804 install --root
Ubuntu1804 run apt update
Ubuntu1804 run apt upgrade -y
@chaseholdren
chaseholdren / .gitignore_global
Last active October 26, 2020 02:35
Run the following command to set your global gitignore: `git config --global core.excludesfile ~/.gitignore_global`
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
@chaseholdren
chaseholdren / index.ts
Created September 12, 2019 11:51
ttw-time-to-work
import * as GoogleMaps from '@google/maps';
import { config } from 'dotenv';
// @ts-ignore
import { Firestore, Timestamp } from '@google-cloud/firestore';
const environment = config().parsed as {
GOOGLE_APPLICATION_CREDENTIALS: string;
MAPS_API_KEY: string;
};
import React from "react";
class ArticleList extends React.Component {
constructor(props) {
super(props);
this.state = { articles: [] };
}
async componentDidMount() {
const result = await fetch("http://sample.com/");
const process = require("process");
const fs = require("fs");
const path = require("path");
const child_process = require("child_process");
const targetFileOrFolder = path.resolve(...process.argv);
console.log(targetFileOrFolder);
const runShellCommand = (command, ...args) => {
const MeleeCharacters = {
bowser: {
name: 'Bowser',
id: 5,
tierPosition: 8,
colors: ['green', 'blue', 'black', 'red'],
defaultColor: 'green',
},
donkeyKong: {
name: 'Donkey Kong',
{
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"jsxSingleQuote": true,
"arrowParens": "always",
"printWidth": 120,
"tabWidth": 2
}
// In response to the following article:
// https://www.jimhribar.com/adventures-in-async-await/
//
// Using Javascripts Object.map function, it's possible to get an array of promises
// which can then be awaited simultaneously, which will execute all of them in parallel.
//
// This is faster than the looping approach in the article, which awaits each Promise individually.
//
// Console output:
// parallelJob: 501.226ms