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 | |
| psql=(psql --username=freecodecamp --dbname=number_guess -t --no-align -X) | |
| #echo $("${psql[@]}" "\d") | |
| get_username="Enter your username:" | |
| welcome_msg="Welcome, %s! It looks like this is your first time here." | |
| welcome_back_msg="Welcome back, %s! You have played %d games, and your best game took %d guesses." | |
| game_prompt_start="Guess the secret number between 1 and 1000:" |
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 | |
| # one two three asdf | |
| if [[ -z $1 ]]; then | |
| printf "Please provide an element as an argument.\n" | |
| exit 0 | |
| fi | |
| arg="$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
| #!/bin/bash | |
| psql="psql --username=freecodecamp --dbname=salon -X -A -t -c" | |
| # use a hash to store ids instead of regular arrays because of fast lookup ability | |
| declare -A service_id_to_name | |
| # use this reg array to keep track of service record order, based on service id | |
| service_order=() | |
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 | |
| if [[ $1 == "test" ]] | |
| then | |
| PSQL="psql --username=postgres --dbname=worldcuptest -t --no-align -c" | |
| else | |
| PSQL="psql --username=freecodecamp --dbname=worldcup -t --no-align -c" | |
| fi | |
| # Do not change code above this line. Use the PSQL variable above to query your database. |
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
| create table galaxy( | |
| galaxy_id serial primary key, | |
| name varchar(30) not null unique, | |
| is_milky boolean not null default false, | |
| age int, | |
| distance numeric | |
| ); | |
| create table star( | |
| star_id serial primary key, |
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 mdInput = document.querySelector('#markdown-input'); | |
| const htmlOutput = document.querySelector('#html-output'); | |
| const htmlPreview = document.querySelector('#preview'); | |
| const Transformers = [ | |
| // block level elems | |
| [/^# (.+)/gm, "<h1>$1</h1>"], | |
| [/^## (.+)/gm, "<h2>$1</h2>"], | |
| [/^### (.+)/gm, "<h3>$1</h3>"], | |
| [/^> (.+)/gm, "<blockquote>$1</blockquote>"], |
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
| function $w(e) { | |
| return (e = e.strip()) ? e.split(/\s+/) : [] | |
| } | |
| function $H(e) { | |
| return e && e.constructor == Hash ? e : new Hash(e) | |
| } | |
| function $(e) { | |
| if (1 < arguments.length) { |
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
| #!/usr/bin/env bash | |
| # set -euxo pipefail | |
| set -euo pipefail | |
| die() { | |
| printf "%s\n" "$*" > "$(tty)" | |
| 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
| authority letsencrypt { | |
| api url "https://acme-v02.api.letsencrypt.org/directory" | |
| account key "/etc/acme/letsencrypt-privkey.pem" | |
| } | |
| # example.net | |
| domain example.net { | |
| alternative names { www.example.net } | |
| domain key "/etc/ssl/private/example.net.key" | |
| domain certificate "/etc/ssl/example.net.crt" |
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
| def solution(a) | |
| total = a.size | |
| lindex = a.size-1 | |
| sorted = a.sort | |
| min = total | |
| combos = [] | |
| return 0 if a == sorted | |
| (2..total).each do |pair_size| |
NewerOlder