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
name: Commit as rich person | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
commit: | |
permissions: |
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
// Example app.tsx file in a Next.js project | |
export default function App(){ | |
useEffect(() => { | |
analytics.init(process.env.NEXT_PUBLIC_AMPLITUDE_API_KEY); | |
}, []); | |
return ( | |
<FeatureFlagsProvider | |
amplitudeExperimentApiKey={ |
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 * as cdk from "aws-cdk-lib"; | |
import { Construct } from "constructs"; | |
import * as sqs from "aws-cdk-lib/aws-sqs"; | |
import { SqsEventSource } from "aws-cdk-lib/aws-lambda-event-sources"; | |
import { Runtime } from "aws-cdk-lib/aws-lambda"; | |
import * as cloudwatch from "aws-cdk-lib/aws-cloudwatch"; | |
import * as cloudwatchActions from "aws-cdk-lib/aws-cloudwatch-actions"; | |
import * as sns from "aws-cdk-lib/aws-sns"; | |
import { | |
LoggingLevel, |
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
<div> | |
<h1>Hello world</h1> | |
</div> |
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
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> |
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
func GetDetails() string { | |
return "wow this is gonna be good" | |
} |
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
func testExecuteRequest_failure_noData() throws { | |
/// create mock to return nil | |
class NetworkMock : NetworkClientProtocol{ | |
func executeRequest(request: URLRequest, completion: @escaping (Data?, Error?) -> Void) { | |
completion(nil, nil) | |
} | |
} | |
/// inject mock and execute request |
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
public final class NetworkClient { | |
private let n: NetworkClientProtocol | |
init(n: NetworkClientProtocol = URLSession.shared) { | |
self.n = n | |
} | |
func executeRequest(request: URLRequest, completion: @escaping (Result<Data, Error>) -> Void) { | |
n.executeRequest(request: request){ (data, error) in | |
if let error = error { |
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
protocol NetworkClientProtocol { | |
func executeRequest(request: URLRequest, completion: @escaping (Data?, Error?) -> Void) | |
} | |
extension URLSession: NetworkClientProtocol{ | |
/// this is where the real request happens | |
func executeRequest(request: URLRequest, completion: @escaping (Data?, Error?) -> Void) { | |
let task = dataTask(with: request) { (data, _, error) in | |
completion(data, error) | |
} |
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
protocol NetworkClientProtocol { | |
func executeRequest(request: URLRequest, completion: @escaping (Data?, Error?) -> Void) | |
} | |
extension URLSession: NetworkClientProtocol{ | |
/// this is where the real request happens | |
func executeRequest(request: URLRequest, completion: @escaping (Data?, Error?) -> Void) { | |
let task = dataTask(with: request) { (data, _, error) in | |
completion(data, error) | |
} |
NewerOlder