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
// In app.js or main.js or whatever: | |
// var myApp = angular.module('askchisne', ['ngSanitize', 'ngAnimate', 'ui.bootstrap', 'ui.bootstrap.tpls']); | |
// This filter makes the assumption that the input will be in decimal form (i.e. 17% is 0.17). | |
myApp.filter('percentage', ['$filter', function ($filter) { | |
return function (input, decimals) { | |
return $filter('number')(input * 100, decimals) + '%'; | |
}; | |
}]); |
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
{ | |
"workbench.iconTheme": "material-icon-theme", | |
"workbench.startupEditor": "newUntitledFile", | |
"workbench.colorCustomizations": { | |
"editorRuler.foreground": "#1a1a1a", | |
// Came from snazzy.json, here: https://github.com/Tyriar/vscode-snazzy/blob/master/snazzy.json | |
"terminalCursor.background": "#282a36", | |
"terminalCursor.foreground": "#97979b", | |
"terminal.selectionBackground": "#97979b33", |
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
// Source: | |
// https://dev.to/ycmjason/how-to-create-range-in-javascript-539i | |
function* range(start, end) { | |
yield start; | |
if (start === end) { | |
return; | |
} | |
yield* range(start + 1, end); | |
} |
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
<project name="condition-test" default="all"> | |
<target name="condition"> | |
<condition property="isTomcat"> | |
<matches pattern="^(tomcat)" string="${webContainer}" /> | |
</condition> | |
<condition property="isWebLogic"> | |
<matches pattern="^(web)" string="${webContainer}" /> | |
</condition> | |
</target> |
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
# To make this server publicly available on the inter-webs while running from localhost, use ngrok, which can be found here: | |
# https://ngrok.com/download. Follow the installation instructions for ngrok and start it up: | |
# | |
# ./ngrok 4567 # (or whatever port you want to listen on). | |
# | |
# ngrok will spit out an ugly but unique URL. After ngrok starts up, you should be able to POST to the sinatra server: | |
# | |
# http://6eee766f.ngrok.com/payload | |
require 'sinatra' | |
require 'json' |
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
// Came from the comments here: https://gist.github.com/maruf-nc/5625869 | |
app.filter('titlecase', function() { | |
return function (input) { | |
var smallWords = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs?\.?|via)$/i; | |
input = input.toLowerCase(); | |
return input.replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g, function(match, index, title) { | |
if (index > 0 && index + match.length !== title.length && | |
match.search(smallWords) > -1 && title.charAt(index - 2) !== ":" && | |
(title.charAt(index + match.length) !== '-' || title.charAt(index - 1) === '-') && |
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
-- from here: https://dataedo.com/kb/query/postgresql/list-foreign-keys | |
select kcu.table_schema || '.' ||kcu.table_name as foreign_table, | |
'>-' as rel, | |
rel_tco.table_schema || '.' || rel_tco.table_name as primary_table, | |
string_agg(kcu.column_name, ', ') as fk_columns, | |
kcu.constraint_name | |
from information_schema.table_constraints tco | |
join information_schema.key_column_usage kcu | |
on tco.constraint_schema = kcu.constraint_schema | |
and tco.constraint_name = kcu.constraint_name |
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
# NOTE: These steps assume that zsh is already installed | |
# Download and install iTerm2, which can be found here: https://iterm2.com/downloads/ | |
# Install oh-my-zsh (details and alternate installation instructions can be found here: https://github.com/ohmyzsh/ohmyzsh): | |
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" | |
# Install the Powerlevel9k theme for zsh (details for using the oh-my-zsh installation can be found here: https://github.com/Powerlevel9k/powerlevel9k/wiki/Install-Instructions#option-2-install-for-oh-my-zsh): | |
git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k |
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
# These commands demonstrate how to determine how much memory is availble on a k8s worker node and how much memory is | |
# available to the k8s _container_ hosted on that node. | |
# Source: | |
# https://shuheikagawa.com/blog/2017/05/27/memory-usage/ | |
# | |
# Other interesting articles: | |
# https://docs.docker.com/engine/docker-overview/#the-underlying-technology | |
# https://docs.docker.com/config/containers/resource_constraints/ | |
# | |
# These values are approximations, because according to the first article, calculating/determining available memory |
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
# Encrypt | |
curl -sbiL -X POST http://localhost:8888/encrypt -d '[the value you want to encrypt]' | |
# Decrypt | |
curl -sbiL -X POST http://localhost:8888/decrypt -d '[the encrypted value, without the "{cipher}" prefix]' |