This file contains hidden or 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
| [alias] | |
| lg = !"git lg1" | |
| lg1 = log --graph --abbrev-commit --decorate --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)' | |
| lg2 = log --graph --abbrev-commit --decorate --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' | |
| lg3 = log --graph --abbrev-commit --decorate --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset) %C(bold cyan)(committed: %cD)%C(reset) %C(auto)%d%C(reset)%n'' %C(white)%s%C(reset)%n'' %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)' |
This file contains hidden or 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
| import { BehaviorSubject, fromEvent, timer } from 'rxjs'; | |
| import { | |
| filter, distinctUntilChanged, shareReplay, tap, debounce, pluck | |
| } from 'rxjs/operators'; | |
| const setValue = (element, value) => { | |
| element.value = value; // eslint-disable-line no-param-reassign | |
| }; | |
| const bindTextInput = (element) => { // Return BehaviorSubject of input text | |
| const subject = new BehaviorSubject(''); |
This file contains hidden or 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
| const isBoolean = b => typeof b === 'boolean'; | |
| const isNumber = n => typeof n === 'number' && !Number.isNaN(n); | |
| const isObject = o => o !== null && typeof o === 'object'; | |
| const isString = s => typeof s === 'string'; |
This file contains hidden or 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
| import pandas as pd | |
| def explode_dataframe_column(df, target_column, separator=','): | |
| """ | |
| Explode target column on seperator | |
| """ | |
| row_accumulator = [] | |
| def splitListToRows(row, separator): | |
| split_row = row[target_column].split(separator) |
This file contains hidden or 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
| #!/bin/bash | |
| usage() { | |
| echo "Usage: $0 [-d <string>] [-u] [-r] [-h]" 1>&2 | |
| echo "-d Directory of target repository, defaults to working directory" 1>&2 | |
| echo "-u Consider untacked files" 1>&2 | |
| echo "-r Do not push to remote repository" 1>&2 | |
| echo "-h Show usage manual" 1>&2 | |
| exit 1 | |
| } |
This file contains hidden or 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
| const wrapper = (as, fn) => ((...args) => { | |
| try { | |
| as(...args); | |
| } catch (error) { | |
| return () => {}; | |
| } | |
| return fn(...args); | |
| }); |
This file contains hidden or 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
| /* Relative positioning for tooltip-enabled elements */ | |
| [data-tooltip] { | |
| position: relative; | |
| cursor: pointer; | |
| } | |
| /* Attributes shared between tooltip content and triangle */ | |
| [data-tooltip]:before, | |
| [data-tooltip]:after { | |
| display: none; /* Hide tooltip by default */ | |
| background-color: #000; |
This file contains hidden or 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
| class Modal { | |
| constructor(message, timeout=3000) { | |
| this.fadeTime = 500; | |
| this.modalBackground = '#f00'; | |
| this.present(message); | |
| this.removeTimer = setTimeout(this.remove.bind(this), timeout); | |
| this.fadeTimer = setTimeout(this.fade.bind(this), timeout - this.fadeTime); | |
| } | |
| present(message) { |
This file contains hidden or 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
| # Prompt | |
| PROMPT='%{%F{red}%}♥%{%F{default}%} %1~ %# ' | |
| # Aliases | |
| alias gitlg="git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all" | |
| # Misc. | |
| export GREP_OPTIONS='--color=auto' |
This file contains hidden or 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
| //bookmarklet_title: Word Frequency | |
| //bookmarklet_about: Display the top five most common words on a webpage. Drag the bookmarklet to your bookmarks bar to use it anywhere! If the word hippo shows up a lot, hippo should have a high occurrence (hippo hippo HIPPO). | |
| var counts = { }; | |
| var text = document.body.innerText || document.body.textContent || ''; | |
| var words = text.split(/\b/).filter((word) => { | |
| return word.match(/^\w+$/) !== null; | |
| }); | |
| words.forEach((word) => { |