Skip to content

Instantly share code, notes, and snippets.

@eheikes
eheikes / load-all-youtube.js
Last active February 17, 2024 23:44
Clicks the "Load More" button in a YouTube list until all videos are loaded.
(function() {
var len = 0;
function loadMore() {
window.scrollBy(0, 9999999);
setTimeout(function() {
var vids = document.querySelectorAll('ytd-playlist-video-renderer');
if (vids.length > len) {
len = vids.length;
loadMore();
}
@eheikes
eheikes / _Karma_Jasmine_Typescript_browser.md
Last active October 28, 2023 14:51
Karma test runner with Jasmine + TypeScript + browser

This is an example setup for using the Karma test runner with a browser-based project written in TypeScript, using Jasmine as the test framework.

Known Issues:

  • Jasmine's fdescribe/fit doesn't work as expected; see note and workaround in the karma.conf.js below.
  • Karma won't restart if a declaration in types changes.
@eheikes
eheikes / git-custom.sh
Last active April 15, 2022 00:22
Git customizations for oh-my-zsh
# Remove the -v option.
alias gc='git commit'
alias gca='git commit -a'
# Create a 'gd' alias.
alias gd="clear; git diff"
compdef _git gd=git-diff
# Create other pull/push aliases.
alias gpull='git fetch origin && git rebase -r origin/`git symbolic-ref --short HEAD 2>/dev/null` "$@" || echo "💣\n💣\n💣\n💣\tCOULD NOT REBASE!\n💣\n💣\n💣"; true'
@eheikes
eheikes / list-open-issues.sh
Last active May 22, 2021 21:02
List all open, unassigned issues for selected Github repos
#!/bin/bash
#
# Lists all open, unassigned issues
# Requires https://github.com/stephencelis/ghi to be installed & configured.
#
# CHANGE THIS to the repositories you want to watch
REPOS=(
'eheikes/aws-tts'
'eheikes/browser-testing-talk'
Download from website: openssl s_client -connect online.banno-uat.com:443
Display info about private key: openssl rsa -text -in private-key.pem -noout
Display info about public key: openssl pkey -inform PEM -pubin -in pub.key -text -noout
Display info about cert: openssl x509 [-days 365] -text -in cert.pem -noout
Get public key from cert: openssl x509 -pubkey -noout -in cert.pem > pubkey.pem
Convert from PEM to CER:
openssl x509 -inform PEM -in online.pem -outform DER -out cert.cer
@eheikes
eheikes / install-npm-modules.sh
Last active June 15, 2020 21:49
Globally-installed npm modules
#!/bin/sh
# npm config set progress false -g
npm install -g \
@captainsafia/legit \
binci \
commitizen \
cz-conventional-changelog \
depcheck \
dockly \
fkill-cli \
@eheikes
eheikes / steps.md
Last active August 26, 2019 20:39
Contributing Types

Prep

First check if the original package is maintained and open to adding types. Check if the package is being actively maintained; if so, create an issue (or look for existing/closed issues) asking for types to be added, and if the maintainers would be open to merging a PR for it.

If the original package can't have the types, they should be added to Definitely Typed. Check in the DT issues/PRs if anyone else is already working on this.

Implementation

If no one else is working on it, we're good to create a PR adding them:

@eheikes
eheikes / notes.md
Last active April 10, 2019 21:51
Jasmine -> Jest migration (WIP)

Migration Steps

  1. yarn add ts-jest jest @types/jest --dev
  2. yarn remove jasmine jasmine-spec-reporter jasmine-ts ts-node proxyquire @types/jasmine @types/proxyquire
  3. yarn ts-jest config:init
  4. Modify jest.config.js if needed.
    • Add modulePathIgnorePatterns: ['.yarn-cache'] if there is a .yarn-cache folder; otherwise you'll get a lot of jest-haste-map errors when running tests.
  5. Update the npm scripts. Give it the folder of tests you want to run (Jest matches against the pattern). Use --verbose to see the breakdown.
    • e.g. NODE_ENV=test jest test/unit --verbose
  • e.g. NODE_ENV=test jest test/unit --verbose --watch
@eheikes
eheikes / update-sys.sh
Last active September 20, 2018 20:49
Update system software (homebrew, gems, node)
#!/bin/bash
echo "Updating the system..."
echo ""
echo "Updating brew..."
brew update
brew upgrade
brew cleanup
@eheikes
eheikes / mysql5.sh
Last active August 20, 2018 03:21
Installs and configures a MySQL 5 server.
#!/bin/bash -x
# Dependency: Webmin should be installed before this script is executed.
# Dependency: UFW should be installed before this script is executed.
# <UDF name="aq_password" Label="Administrator Password" />
# <UDF name="new_hostname" Label="Computer Hostname (all lowercase)" example="basicshared1" />
# Include http://www.linode.com/stackscripts/view/?StackScriptID=1
source <ssinclude StackScriptID="1">
#