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
//! A simple test that creates a http client, fetches the first page of starred items for a given user | |
//! and prints each repo with their topics, as well as each language and the amount of repos for that language. | |
//! Sample output: | |
//! Repo name is gluesql/gluesql ({ database, nosql, rust, schemaless, sql, storage, webassembly, websql }) | |
//! Repo name is efugier/smartcat ({ ai, chatgpt, cli, command-line, command-line-tool, copilot, llm, mistral-ai, unix }) | |
//! Repo name is regolith-labs/steel ({ solana }) | |
//! Language Rust: 13 repos | |
//! Language Zig: 2 repos | |
//! Language Jupyter Notebook: 1 repos | |
//! Language HTML: 1 repos |
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
public class Application { | |
static String solve(String word) { | |
Objects.requireNonNull(word); | |
Map<String, Integer> chars = new LinkedHashMap<String, Integer>(); | |
for (int i = 0; i < word.length(); i++) { | |
var w = word.charAt(i); | |
chars.compute(String.valueOf(w), (k, v) -> { | |
if (v != null) { |
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
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE NoImplicitPrelude #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE TypeApplications #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeOperators #-} |
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 React, { useEffect } from "react"; | |
import { connect, styled } from "frontity"; | |
import Link from "./link"; | |
import List from "./list"; | |
import Item from "./list/list-item"; | |
import FeaturedMedia from "./featured-media"; | |
const Post = ({ state, actions, libraries }) => { | |
// Get information about the current URL. |
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 promiseWithTimeout = (timeoutMs, promise, failureMessage) => { | |
var timeoutHandle; | |
const timeoutPromise = new Promise((resolve, reject) => { | |
timeoutHandle = setTimeout(() => reject(new Error(failureMessage)), timeoutMs); | |
}); | |
return Promise.race([ | |
promise, | |
timeoutPromise, | |
]).then((result) => { |
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
package com; | |
import static java.lang.String.valueOf; | |
import static java.util.Objects.isNull; | |
import static java.util.Objects.nonNull; | |
import java.util.ArrayList; | |
import java.util.LinkedList; | |
import java.util.List; | |
import java.util.stream.Collectors; |
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
package example.controller | |
import arrow.fx.reactor.FluxK | |
import arrow.fx.reactor.extensions.fluxk.async.effect | |
import arrow.fx.reactor.value | |
import example.ParserService | |
import org.springframework.web.bind.annotation.GetMapping | |
import org.springframework.web.bind.annotation.RequestParam | |
import org.springframework.web.bind.annotation.RestController | |
import reactor.core.publisher.Flux |
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
use std::cmp::Ordering; | |
use std::io; | |
use rand::Rng; | |
fn main() { | |
println!("Guess the number!"); | |
let secret_number = rand::thread_rng().gen_range(1, 101); | |
let mut attempts : Vec<u32> = Vec::new(); |
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
package io.github.pauljamescleary.petstore.domain.destination | |
import scala.language.higherKinds | |
trait DestinationRepositoryAlgebra[F[_]] { | |
def destinations(departureId: Long): F[List[Long]] | |
} |
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
public class FindOutlier { | |
public static int find(int[] numbers) { | |
int lastOdd = 0; | |
int lastEven = 0; | |
int totalOdd = 0; | |
int totalEven = 0; | |
for (int i = 0; i < numbers.length; i++) { |
NewerOlder