Type | Example |
---|---|
1. Simple GET request | fetch('{url}'). then(response => console.log(response)); |
2. Simple POST request | fetch('{url}', { method: 'post' }) .then(response => console.log(response)); |
3. GET with an authorization token (Bearer) | fetch('{url}', { headers: { 'Authorization': 'Basic {token}' } }) .then(response => console.log(response)); |
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
package main | |
// Checking for an SSL certificate | |
import ( | |
"crypto/tls" | |
) | |
func main() { |
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
async function appendToList(table, key, ue, ean, eav) { | |
const params = { | |
TableName: table, | |
Key: key, | |
UpdateExpression: ue, | |
ExpressionAttributeNames: ean, | |
ExpressionAttributeValues: eav | |
} |
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
async function appendToAnObject (table, key, ue, ean, eav) { | |
const params = { | |
TableName: table, | |
Key: key, | |
UpdateExpression: ue, | |
ExpressionAttributeNames: ean, | |
ExpressionAttributeValues: eav | |
} |
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
is_prime = (num) => { | |
if (num == 1) { | |
return false | |
} | |
let i = 2 | |
while (i * i <= num) { | |
if (num % i == 0) { | |
return false | |
} |
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
async function updateNestedAttribute(table, key, ue, ce, ean, eav) { | |
const params = { | |
TableName: table, | |
Key: key, | |
UpdateExpression: ue, | |
ConditionExpression: ce, | |
ExpressionAttributeNames: ean, | |
ExpressionAttributeValues: eav | |
} |
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 AWS = require('aws-sdk') | |
const ddb = new AWS.DynamoDB.DocumentClient() |
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
# O(2^n) | |
from time import time | |
def fibonacci(num): | |
if num == 0: | |
return 0 | |
elif num == 1: | |
return 1 | |
else: |
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
// Tests and Benchmarking Time | |
let startOne = Date.now(); | |
console.log(fibonacciRecursive(1)); | |
console.log(fibonacciRecursive(4)); | |
console.log(fibonacciRecursive(12)); | |
console.log(fibonacciRecursive(40)); | |
let endOne = Date.now(); | |
console.log("Naive Recursive Time (ms): ", endOne - startOne); | |
let startTwo = Date.now(); |