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
import random | |
output = dict() | |
try: | |
friends_count = int(input("Enter the number of friends joining (including you):")) | |
if friends_count < 1: | |
print("No one is joining for the party") | |
else: | |
print("Enter the name of every friend (including you), each on a new line:") | |
for i in range(friends_count): | |
name = input() |
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
python3 -m pip install \ | |
--config-settings="--global-option=build_ext" \ | |
--config-settings="--global-option=-I$(brew --prefix graphviz)/include/" \ | |
--config-settings="--global-option=-L$(brew --prefix graphviz)/lib/" \ | |
pygraphviz |
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
DROP ROLE IF EXISTS readaccess; | |
CREATE ROLE readaccess; | |
GRANT USAGE ON SCHEMA public TO readaccess; | |
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess; | |
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess; | |
DROP USER IF EXISTS readonly; |
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
import products from './products' | |
let productName = "tote bag"; | |
let shipping: number; | |
let taxPercent: number; | |
let taxTotal: number; | |
let total: number; | |
const shippingAddress = 'SHCES 505 bloco A'; | |
const product = products.find((product) => product.name === productName) |
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
import restaurants from './restaurants'; | |
const dollarSigns = '$$'; | |
const deliveryTimeMax = 90; | |
const maxDistance = 10; | |
let result: string; | |
let hour = new Date().getHours() | |
const priceBracket: number = dollarSigns.length; |
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 Calculate = { | |
factorial: (inputValue) => { | |
if (inputValue === 0) {return 1} | |
else if (inputValue > 0) { | |
let result = 1 | |
for(let i = 1; i <= inputValue; i++) { | |
result *= i | |
} | |
return result | |
} |
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
// Define a rooster | |
Rooster = {}; | |
// Return a morning rooster call | |
Rooster.announceDawn = () => { | |
return 'cock-a-doodle-doo!'; | |
} | |
// Return hour as string | |
// Throws Error if hour is not between 0 and 23 inclusive |
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 {assert} = require('chai'); | |
const {jsdom} = require('jsdom'); | |
const parseTextFromHTML = (htmlAsString, selector) => { | |
const selectedElement = jsdom(htmlAsString).querySelector(selector); | |
if (selectedElement !== null) { | |
return selectedElement.textContent; | |
} else { | |
throw new Error(`No element with selector ${selector} found in HTML string`); | |
} |
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
SELECT * FROM trips; | |
SELECT * FROM riders; | |
SELECT * FROM cars; | |
select * from riders cross join cars; | |
select * from trips left join riders on trips.rider_id = riders.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
SELECT title, score | |
FROM hacker_news | |
ORDER BY score DESC | |
LIMIT 5; | |
SELECT SUM(score) FROM hacker_news; | |
SELECT user, SUM(score) FROM hacker_news GROUP BY user HAVING SUM(score) > 200 ORDER BY 2 DESC; | |
SELECT (517 + 309 + 304 + 282) / 6366.0; |
NewerOlder