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
const fizzBuzzMap = { | |
3: 'Fizz', | |
5: 'Buzz', | |
15: 'FizzBuzz' | |
}; | |
/** | |
* The classic "Fizz Buzz" game: Print a list of numbers from 1 to the upper limit, using the following rules: | |
* * If the number is divisible by 3 print "Fizz" | |
* * If the number is divisible by 5 print "Buzz" |
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
/* Been going through the Learn C++ tutorial (https://www.learncpp.com/), and so far this seems to be a pretty good setup for | |
tasks.json in VS Code. This tasks.json file is specific for clang++ (I'm on macOS 13.x), so you may need to update the `args` | |
to suit your own environment. In particular, you will want to replace with {your application name here} with whatever you want | |
your build artifact to be named. | |
*/ | |
{ | |
"tasks": [ | |
{ | |
"type": "cppbuild", | |
"label": "C/C++: clang++ build active file", |
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
/****************************************************************************************************************************** | |
I was watching a video of a guy reading an article (man... what fucking strange times we live in...) about developers missing | |
basic programming skills because they rely on npm packages to do the work for them. There are packages like left-pad, is-array, | |
is-positive-integer, etc. Apparently some change in the left-pad package broke a bunch of big-time repos (including React). | |
This is a link to said video: https://www.youtube.com/watch?v=NmHUjxKpD90 | |
My main take-aways from the article/video were: | |
* just because it's a package that gets downloaded a bunch of times doesn't mean it's good, quality code | |
* don't introduce a dependency if you don't need to | |
* an over-reliance on external dependencies: |
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
set laststatus=2 | |
set nu | |
syntax on | |
set statusline= " clear the statusline for when vimrc is reloaded | |
set statusline+=%-3.3n\ " buffer number | |
set statusline+=%f\ " file name | |
set statusline+=%h%m%r%w " flags | |
set statusline+=[%{strlen(&ft)?&ft:'none'}, " filetype | |
set statusline+=%{strlen(&fenc)?&fenc:&enc}, " encoding |
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
CREATE USER [database owner name] WITH CREATEROLE ENCRYTPED PASSWORD '[database owner's password]'; | |
CREATE DATABASE [database name] OWNER [database owner name]; | |
-- connect to [database name] | |
REVOKE CREATE ON SCHEMA public FROM PUBLIC; | |
REVOKE ALL ON DATABASE [database name] FROM PUBLIC; | |
REVOKE ALL ON ALL TABLES IN SCHEMA public FROM PUBLIC; | |
-- log in as [database owner name] to [database name] db | |
CREATE SCHEMA [schema 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
{ | |
"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
-- 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
# Assume the following scenario: | |
# * You have a bastion/jump server that is publicly available | |
# * You have an RDS instance that is _not_ publicly accessible, but the bastion can get to it | |
# | |
# We have this setup with some of our k8s clusters: the cluster was created via kops, which _also_ sets up a VPC, a | |
# bastion server, all that good stuff. We use a "private" network topology to minimize public access to any of the | |
# resources in the cluster. | |
# | |
# We _also_ create our RDS instances in the same VPC. The bastion and nodes get access to the RDS instance, but it isn't | |
# available to us common folk out here on the internet. That's good; we want to minimize access to the database, too. |
NewerOlder