Skip to content

Instantly share code, notes, and snippets.

Strings

String.prototype.*

None of the string methods modify this – they always return fresh strings.

  • charAt(pos: number): string ES1

    Returns the character at index pos, as a string (JavaScript does not have a datatype for characters). str[i] is equivalent to str.charAt(i) and more concise (caveat: may not work on old engines).

@aghuddleston
aghuddleston / .bashrc
Last active April 4, 2017 17:36 — forked from jusopi/check.sh
Set node version per project using .nvmrc file
cd() {
builtin cd "$1"
if [ -f ".nvmrc" ]; then
nvm use
fi
}
@aghuddleston
aghuddleston / docker-terminal.sh
Created August 18, 2016 13:52 — forked from okunishinishi/docker-terminal.sh
Start docker and change terminal theme on osx.
#!/bin/bash
#
# Start Docker terminal and set theme.
#
TERMINAL_APP="Terminal"
TERMINAL_THEME="Novel"
# Set Terminal theme
osascript -e "
@aghuddleston
aghuddleston / chevron_toggle.html
Created March 7, 2016 15:05 — forked from swanson/chevron_toggle.html
Autoswap Bootstrap icon-chevron when using Collapsible
<a class="btn" data-toggle="collapse" data-target="#my-container">
Toggle <i class="icon-chevron-right"></i>
</a>
<div id="#my-container">
... cool stuff goes here ...
</div>
Get the Heroku db as detailed here:
http://devcenter.heroku.com/articles/pgbackups#exporting_via_a_backup
1. heroku pgbackups:capture
2. heroku pgbackups:url <backup_num> #=>backup_url
- get backup_num with cmd "heroku pgbackups"
3. curl -o latest.dump <backup_url>
Then locally do:
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U myuser -d mydb latest.dump
#! /bin/sh
# ==================================================================
# ______ __ _____
# /_ __/___ ____ ___ _________ _/ /_ /__ /
# / / / __ \/ __ `__ \/ ___/ __ `/ __/ / /
# / / / /_/ / / / / / / /__/ /_/ / /_ / /
#/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/
# Multi-instance Apache Tomcat installation with a focus
# on best-practices as defined by Apache, SpringSource, and MuleSoft