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
| void main() { | |
| IO.println("=== Java Knowledge Quiz ===\n"); | |
| // FIVE parallel arrays | |
| String[] questions = { | |
| "What type stores decimal numbers?", | |
| "How do you get text from the user?", | |
| "What does ++ do to a variable?", | |
| "Which loop should be used if we don't how many times it would be executed?", | |
| "What method gets string 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
| package com.example; | |
| import java.lang.reflect.InvocationHandler; | |
| import java.lang.reflect.InvocationTargetException; | |
| import java.lang.reflect.Method; | |
| import java.lang.reflect.Proxy; | |
| import java.util.HashMap; | |
| import java.util.List; | |
| import java.util.Map; |
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 SwiftUI | |
| let identifiers = NSLocale.availableLocaleIdentifiers | |
| let locale = NSLocale(localeIdentifier: "en_US") | |
| let currencyFormatter = NumberFormatter() | |
| currencyFormatter.numberStyle = .currency | |
| currencyFormatter.usesGroupingSeparator = true | |
| currencyFormatter.maximumFractionDigits = 2 |
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 { HttpError as HE } from 'routing-controllers'; | |
| export class HttpError extends HE { | |
| constructor(httpCode: number, message?: string, readonly data?: any) { | |
| super(httpCode, message); | |
| Object.setPrototypeOf(this, HttpError.prototype); | |
| } | |
| toJSON() { |
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 cosineSimilarity(a: number[], b: number[]) { | |
| let dotProduct = 0; | |
| let magnitudeA = 0; | |
| let magnitudeB = 0; | |
| for (let i = 0; i < a.length; i++) { | |
| dotProduct += (a[i] * b[i]); | |
| magnitudeA += (a[i] * a[i]); | |
| magnitudeB += (b[i] * b[i]); | |
| } | |
| magnitudeA = Math.sqrt(magnitudeA); |
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 = 'hi:ha:ho'; | |
| const matches = input.match(/(.*):(.*):(.*)/); | |
| const firstGroup = matches[1]; | |
| const secondGroup = matches[2]; | |
| const thirdGroup = matches[3]; | |
| console.log(firstGroup, secondGroup, thirdGroup); | |
| // prints out: hi ha ho |
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 base64 | |
| payload = 'VKlNGb4mCR/5BBunW4d7jpwp/KI1pRcsW/DeuMzXThh+nz8HRMI54bmWLKjC3haJuBGZQmX/SfNIACU=' | |
| payloadEncoded = payload.encode("UTF-8") | |
| payloadArray = base64.b64decode(payload) | |
| nonceArray = payloadArray[0:24] | |
| msgArray = payloadArray[24:len(payloadArray)] | |
| from nacl.secret import SecretBox |
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 doSomething() { | |
| return 'some result' | |
| } | |
| async function doSomethingAndFail() { | |
| throw new Error() | |
| } | |
| describe('promise testing', () => { |
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
| /** | |
| * Copyright 2017, Google, Inc. | |
| * 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 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software | |
| * distributed under the License is distributed on an "AS IS" BASIS, |
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 | |
| CUR_DIR=$(pwd) | |
| echo "\n\033[1mPulling in latest changes for all repositories in $CUR_DIR directory\033[0m\n" | |
| for i in $(find . -name ".git" | cut -c 3-); do | |
| echo ""; | |
| echo "\033[33m"+$i+"\033[0m"; | |
| cd "$i"; |
NewerOlder