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
# ~/.gnupg/gpg-agent.conf | |
# | |
# Connects gpg-agent to the OSX keychain via the brew-installed | |
# pinentry program from GPGtools. This is the OSX 'magic sauce', | |
# allowing the gpg key's passphrase to be stored in the login | |
# keychain, enabling automatic key signing. | |
pinentry-program /usr/local/bin/pinentry-mac |
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 mockRegistry = { definitions: {}, registerPath: jest.fn() }; | |
const mockGenerator = { generateDocument: jest.fn() }; | |
jest.mock('@asteasolutions/zod-to-openapi', () => ({ | |
extendZodWithOpenApi: jest.fn(), | |
OpenAPIRegistry: function () { | |
return mockRegistry; | |
}, | |
OpenApiGeneratorV3: function () { | |
return mockGenerator; |
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
sealed interface Validator { | |
fun validate(value: String): Int? | |
} | |
object RequiredValidator : Validator { | |
override fun validate(value: String): Int? = | |
if (value.isNotBlank()) null else ValidationError.Required | |
} | |
object EmailValidator : Validator { |
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
data class CounterUiState(val counter: Int = 0) : State | |
sealed class CounterAction : Action { | |
object Increment : CounterAction() | |
object Decrement : CounterAction() | |
data class SetValue(val value: Int) : CounterAction() | |
} | |
class CounterViewModel : ViewModel() { | |
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
@Composable | |
fun DatePicker( | |
label: String, | |
value: String, | |
onValueChange: (String) -> Unit = {}, | |
keyboardActions: KeyboardActions = KeyboardActions.Default, | |
keyboardOptions: KeyboardOptions = KeyboardOptions.Default, | |
pattern: String = "yyyy-MM-dd", | |
) { | |
val formatter = DateTimeFormatter.ofPattern(pattern) |
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
{ | |
"[rust]": { | |
"editor.formatOnSave": true | |
}, | |
"[typescript]": { | |
"editor.formatOnSave": true | |
}, | |
"[typescriptreact]": { | |
"editor.formatOnSave": true | |
}, |
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 kotlin.random.Random | |
fun main() { | |
val secretNumber = Random.nextInt(1, 100) | |
var numTries = 0 | |
var numTriesLeft: Int | |
var gameWon = false | |
println("Welcome to Guess a number!") |
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
@ExperimentalComposeUiApi | |
@Composable | |
fun LoginScreen( | |
viewModel: LoginViewModel, | |
navigateToOverview: () -> Unit = {}, | |
onBack: () -> Unit = {}, | |
) { | |
val uiState by viewModel.uiState.collectAsState() | |
val (username, setUsername) = viewModel.username |
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
// See: https://github.com/vercel/next.js/blob/canary/examples/api-routes-apollo-server/pages/api/graphql.js | |
import {AsyncExecutor} from '@graphql-tools/delegate'; | |
import {introspectSchema, wrapSchema} from '@graphql-tools/wrap'; | |
import {ApolloServer} from 'apollo-server-micro'; | |
import {print} from 'graphql'; | |
import fetch from 'isomorphic-unfetch'; | |
import {NextApiRequest, NextApiResponse} from 'next'; | |
import getConfig from 'next/config'; |
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 {ApolloServer} from 'apollo-server-micro'; | |
import {NextApiRequest, NextApiResponse} from 'next'; | |
import {resolvers} from '@/graphql/resolvers'; | |
import typeDefs from '@/graphql/schema.graphql'; | |
const handler = async (req: NextApiRequest, res: NextApiResponse) => { | |
return new ApolloServer( | |
resolvers, |
NewerOlder