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
/** | |
* Service file that takes care of importing all environment variables used, | |
* as well as making sure they're all truthy and correctly typed. | |
*/ | |
import { LOG_LEVELS } from './log.ts' | |
const _LOG_LEVEL = Deno.env.get('LOG_LEVEL') | |
// find() ensures correct typing (don't want just a raw string) | |
export const LOG_LEVEL = LOG_LEVELS.find((l) => l === _LOG_LEVEL) || 'all' |
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 input = { | |
a: { | |
b: { | |
c: 12, | |
d: "Hello World", | |
}, | |
e: [1, 2, 3], | |
}, | |
hi: "there", | |
checks: { |
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 strings = ['boo', 'bar', 'biz', 'baz'] | |
// piece everything together | |
console.log(strings.join()). // boo,bar,biz,baz | |
// or add a delimiter, like '\n' | |
console.log(strings.join('\n')) // boo\nbar\nbiz\baz | |
// find strings that match our condition | |
console.log(strings.filter((s) => s.includes('a'))) // [ 'bar', 'baz' ] |
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
/** | |
* Writing tests for functions that use external dependencies is tough. | |
* We can get past this by using sinon sandboxes to temporarily overwrite the | |
* prototypes of those dependencies, just for testing | |
* | |
* Before running these tests run: | |
* $ npm install --save-dev aws-sdk sinon mocha | |
*/ | |
/** |
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
/** | |
* Document module | |
* | |
* This module serves as a basic CRUD implementation of 'document' objects. | |
* It is meant to be consumed by a frontend webapp and used to talk to an API. | |
*/ | |
// Import the Axios instance with our backend information | |
import { api } from '@/constants/globals.constant' |
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 com.towson.wavyleaf; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import org.apache.http.HttpResponse; | |
import org.apache.http.client.HttpClient; | |
import org.apache.http.client.methods.HttpPost; |
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
import java.io.IOException; | |
import java.net.DatagramPacket; | |
import java.net.DatagramSocket; | |
import java.net.InetAddress; | |
import java.text.DecimalFormat; | |
import java.util.Scanner; | |
/** | |
* NtpClient - an NTP client for Java. This program connects to an NTP server |
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
// THIS IS A BETA! I DON'T RECOMMEND USING IT IN PRODUCTION CODE JUST YET | |
/* | |
* Copyright 2012 Roman Nurik | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 |