Contains some helpful TypeScript functions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Lists the top-level global NPM packages | |
npm ls -g --depth=0 | |
// Restart bluetooth service on Mac | |
sudo launchctl stop com.apple.blued | |
sudo launchctl start com.apple.blued | |
// Disable press-and-hold on Mac, essentially disabling the hold-to-select-special-character-version-of-letter | |
// Can be undone by using the same command with -bool true | |
defaults write -g ApplePressAndHoldEnabled -bool false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. `git rebase -i HEAD~2` | |
2. navigate to commit with arrows | |
3. press `d` twice to delete commit | |
4. enter `:wq` to save and quit (if it doesn’t let you, press escape first, and then enter this command) | |
5. force-push the branch to get rid of the remote commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.truncate { | |
width: 250px; // Not required as container's width is usually sufficient | |
white-space: nowrap; | |
overflow: hidden; | |
text-overflow: ellipsis; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class ArrayUtilities { | |
/** | |
* Groups a collection by a property to a Map type. | |
* @param collection The collection to group. | |
* @param groupKeyResolver Contains the property to group by, computed from a function. | |
* @returns Map key-value pair collection with given property as key and elements with that property as values. | |
*/ | |
public static groupBy<K, T>(collection: T[], groupKeyResolver: (item: T) => K): Map<K, T[]> { | |
return collection.reduce( | |
(map: Map<K, T[]>, item: T) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ul { | |
display: table; | |
width: 100%; | |
list-style: none; | |
} | |
ul li { | |
display: table-cell; | |
text-align: center; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use this script in a connection within the Auth0 Tenant that you want to copy the user TO | |
// Use the variables defined in the login functions to specify the 'other' Auth0 Tenant that you want to copy the users FROM | |
function login (email, password, callback) { | |
// Require and set up all the Auth0 settings | |
var request = require('request'), | |
domain = 'OTHER TENANTS DOMAIN', | |
domain_uri = 'https://' + domain, | |
audience = 'OTHER TENANTS API AUDIENCE', | |
scope = 'openid profile email', | |
client_id = 'OTHER TENANTS CLIENT ID', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal class Program | |
{ | |
private static void Main(string[] args) | |
{ | |
var welcome = @" | |
___ _ _ _ _ _ _ _ __ | |
/ _ \ | | (_) (_)| | (_)| | | | / / | |
/ /_\ \ ___ | |_ _ __ __ _ | |_ ___ _ | |_ ___ _ __ | |/ / ___ _ _ ____ ___ | |
| _ | / __|| __|| |\ \ / /| || __| / _ \| || __| / _ \| '_ \ | \ / _ \| | | ||_ / / _ \ | |
| | | || (__ | |_ | | \ V / | || |_ | __/| || |_ | __/| | | || |\ \| __/| |_| | / / | __/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// First create a new index on the desired database. | |
// Say we have an Activity collection, we could write the following index: | |
from activity in docs.Activities | |
select new { | |
activity.Id | |
} | |
// After that, we can query the database using a combination of the created index and a Lucene query. | |
// In this example, we can specify the exact Id of the document we would like to query for. | |
Id: activities/1 |