file_path stringlengths 3 280 | file_language stringclasses 66
values | content stringlengths 1 1.04M | repo_name stringlengths 5 92 | repo_stars int64 0 154k | repo_description stringlengths 0 402 | repo_primary_language stringclasses 108
values | developer_username stringlengths 1 25 | developer_name stringlengths 0 30 | developer_company stringlengths 0 82 |
|---|---|---|---|---|---|---|---|---|---|
src/ui/molecules/sandbox-banner.svelte | Svelte | <script lang="ts">
import { fly } from "svelte/transition";
import CloseButton from "./close-button.svelte";
import { Logger } from "../../helpers/logger";
export let style = "";
export let isInElement = false;
let showBanner = true;
function closeBanner() {
Logger.debugLog("closeBanner");
show... | yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
src/ui/molecules/secure-checkout-rc.svelte | Svelte | <script lang="ts">
import Localized from "../localization/localized.svelte";
import { LocalizationKeys } from "../localization/supportedLanguages";
import { getContext } from "svelte";
import { translatorContextKey } from "../localization/constants";
import { Translator } from "../localization/translator";
... | yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
src/ui/molecules/stripe-payment-elements.svelte | Svelte | <script lang="ts">
import { getContext, onMount } from "svelte";
import type {
Appearance,
ConfirmationToken,
Stripe,
StripeElementLocale,
StripeElements,
StripeError,
StripePaymentElement,
StripePaymentElementChangeEvent,
} from "@stripe/stripe-js";
import { type BrandingInfoRes... | yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
src/ui/organisms/product-info.svelte | Svelte | <script lang="ts">
import {
type Product,
type PurchaseOption,
ProductType,
type SubscriptionOption,
} from "../../entities/offerings";
import PricingTable from "../molecules/pricing-table.svelte";
import ProductInfoHeader from "../molecules/product-header.svelte";
import PricingSummary from "... | yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
src/ui/pages/email-entry-page.svelte | Svelte | <script lang="ts">
import Button from "../atoms/button.svelte";
import ModalFooter from "../layout/modal-footer.svelte";
import ModalSection from "../layout/modal-section.svelte";
import RowLayout from "../layout/row-layout.svelte";
import { validateEmail } from "../../helpers/validators";
import { Purchase... | yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
src/ui/pages/error-page.svelte | Svelte | <script lang="ts">
import {
PurchaseFlowError,
PurchaseFlowErrorCode,
} from "../../helpers/purchase-operation-helper";
import IconError from "../atoms/icons/icon-error.svelte";
import { getContext, onMount } from "svelte";
import { Logger } from "../../helpers/logger.js";
import MessageLayout from ... | yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
src/ui/pages/payment-entry-loading-page.svelte | Svelte | <script>
import Loading from "../molecules/loading.svelte";
</script>
<Loading />
| yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
src/ui/pages/payment-entry-page.svelte | Svelte | <script lang="ts">
import { getContext, onMount } from "svelte";
import type { StripeElementLocale } from "@stripe/stripe-js";
import type { Product, PurchaseOption } from "../../entities/offerings";
import { type BrandingInfoResponse } from "../../networking/responses/branding-response";
import IconError fro... | yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
src/ui/pages/success-page.svelte | Svelte | <script lang="ts">
import IconSuccess from "../atoms/icons/icon-success.svelte";
import MessageLayout from "../layout/message-layout.svelte";
import { type Product, ProductType } from "../../entities/offerings";
import { getContext, onMount } from "svelte";
import { translatorContextKey } from "../localizatio... | yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
src/ui/purchases-ui-inner.svelte | Svelte | <script lang="ts">
import PaymentEntryPage from "./pages/payment-entry-page.svelte";
import EmailEntryPage from "./pages/email-entry-page.svelte";
import ErrorPage from "./pages/error-page.svelte";
import SuccessPage from "./pages/success-page.svelte";
import LoadingPage from "./pages/payment-entry-loading-pa... | yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
src/ui/purchases-ui.svelte | Svelte | <script lang="ts">
import { onMount, setContext, onDestroy } from "svelte";
import type { Package, Product, PurchaseOption, Purchases } from "../main";
import { type BrandingInfoResponse } from "../networking/responses/branding-response";
import {
PurchaseFlowError,
PurchaseFlowErrorCode,
PurchaseO... | yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
src/ui/theme/colors.ts | TypeScript | import type { BrandingAppearance } from "../../entities/branding";
/**
* All those colors get translated in --rc-color-<property_name> css variables.
* i.e. --rc-color-error or --rc-color-input-background
*/
export interface Colors {
error: string;
warning: string;
focus: string;
accent: string;
primary: ... | yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
src/ui/theme/constants.ts | TypeScript | export const PaywallDefaultContainerZIndex = 1000001;
| yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
src/ui/theme/shapes.ts | TypeScript | export interface Shape {
"input-border-radius": string;
"input-button-border-radius": string;
}
export const RoundedShape: Shape = {
"input-border-radius": "4px",
"input-button-border-radius": "8px",
};
export const RectangularShape: Shape = {
"input-border-radius": "0px",
"input-button-border-radius": "0... | yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
src/ui/theme/spacing.ts | TypeScript | export interface Spacing {
[key: string]: {
mobile: string;
tablet: string;
desktop: string;
};
}
export const DEFAULT_SPACING: Spacing = {
outerPadding: {
mobile: "clamp(1.3125rem, 5.6vw, 1.5rem)",
tablet: "clamp(1.40625rem, 7.52vw, 3.25rem)",
desktop: "clamp(1.5rem, 9.44vw, 5rem)",
},... | yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
src/ui/theme/text.ts | TypeScript | /**
* All text styles get translated into --rc-text-<property_name> CSS variables.
* i.e., --rc-text-title1-font-size or --rc-text-title1-line-height
*/
interface TextStyle {
fontSize: string;
lineHeight: string;
fontWeight: string;
}
export interface TextStyles {
[key: string]: {
mobile: TextStyle;
... | yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
src/ui/theme/theme.ts | TypeScript | import {
toFormColors,
toFormStyleVar,
toProductInfoStyleVar,
toShape,
toSpacingVars,
toTextStyleVar,
} from "./utils";
import type { Shape } from "./shapes";
import type { Colors } from "./colors";
import { DEFAULT_TEXT_STYLES } from "./text";
import { DEFAULT_SPACING } from "./spacing";
import type { Bran... | yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
src/ui/theme/utils.ts | TypeScript | import {
type Colors,
DEFAULT_FORM_COLORS,
DEFAULT_INFO_COLORS,
FormColorsToBrandingAppearanceMapping,
InfoColorsToBrandingAppearanceMapping,
} from "./colors";
import {
DefaultShape,
PillsShape,
RectangularShape,
RoundedShape,
type Shape,
} from "./shapes";
import { DEFAULT_FONT_FAMILY, type TextSt... | yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
src/ui/types/payment-element-error.ts | TypeScript | export enum PaymentElementErrorCode {
ErrorLoadingStripe = 0,
HandledFormSubmissionError = 1,
UnhandledFormSubmissionError = 2,
}
export type PaymentElementError = {
code: PaymentElementErrorCode;
gatewayErrorCode: string | undefined;
message: string | undefined;
};
| yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
src/ui/ui-types.ts | TypeScript | import type { TaxBreakdown } from "../networking/responses/checkout-calculate-tax-response";
import type { PurchaseFlowError } from "../helpers/purchase-operation-helper";
export type CurrentPage =
| "email-entry"
| "email-entry-processing"
| "payment-entry-loading"
| "payment-entry"
| "payment-entry-process... | yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
svelte.config.js | JavaScript | import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
export default {
preprocess: [
vitePreprocess({
style: {
postcss: true,
},
}),
],
};
| yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
test.html | HTML | <!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>RCBilling Example</title>
<script src="./dist/rcbilling-js.iife.js"></script>
<style>
/* Some basic styling for our Stripe form */
#payment-f... | yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
vite.config.js | JavaScript | import { fileURLToPath } from "url";
import { dirname, resolve } from "path";
import { defineConfig } from "vite";
import dts from "vite-plugin-dts";
import { svelte } from "@sveltejs/vite-plugin-svelte";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
export default defineCo... | yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
vitest.config.js | JavaScript | import { configDefaults, defineConfig } from "vitest/config";
import { svelte } from "@sveltejs/vite-plugin-svelte";
import { svelteTesting } from "@testing-library/svelte/vite";
export default defineConfig(() => ({
plugins: [
svelte({
compilerOptions: {
css: "injected",
},
preprocess: ... | yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
vitest.setup.js | JavaScript | // Or configuring DOM elements that your app expects on startup
document.body.innerHTML = `<div id="app"></div>`;
if (!Element.prototype.animate) {
Element.prototype.animate = () => ({
cancel: () => {},
play: () => {},
pause: () => {},
finish: () => {},
});
}
| yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
vitest.shims.d.ts | TypeScript | /// <reference types="@vitest/browser/providers/playwright" /> | yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
vitest.workspace.js | JavaScript | import path from "node:path";
import { fileURLToPath } from "node:url";
import { defineWorkspace } from "vitest/config";
import { storybookTest } from "@storybook/addon-vitest/vitest-plugin";
const dirname =
typeof __dirname !== "undefined"
? // eslint-disable-next-line no-undef
__dirname
: path.dirn... | yannbf/purchases-js-repro | 0 | TypeScript | yannbf | Yann Braga | chromaui | |
cmd/dstp/dstp.go | Go | package main
import (
"context"
flag "github.com/spf13/pflag"
"fmt"
"os"
"path/filepath"
"github.com/ycd/dstp/config"
"github.com/ycd/dstp/pkg/dstp"
)
func main() {
fs := flag.NewFlagSet(filepath.Base(os.Args[0]), flag.ExitOnError)
// Configure the options from the flags/config file
opts, err := config.... | ycd/dstp | 1,294 | 🧪 Run common networking tests against any site. | Go | ycd | Yagiz Degirmenci | |
config/config.go | Go | package config
import (
flag "github.com/spf13/pflag"
"fmt"
"os"
"github.com/fatih/color"
)
type Config struct {
Addr string
Output string
PingCount int
Timeout int
ShowHelp bool
Port string
CustomDnsServer string
}
var usageStr = `Usage: dstp [OPTIONS... | ycd/dstp | 1,294 | 🧪 Run common networking tests against any site. | Go | ycd | Yagiz Degirmenci | |
pkg/common/color.go | Go | package common
import "github.com/fatih/color"
// Bunch of pre-defined coloring functions
var (
Yellow = color.New(color.FgYellow).SprintFunc()
Red = color.New(color.FgRed).SprintFunc()
Green = color.New(color.FgGreen).SprintFunc()
Blue = color.New(color.FgBlue).SprintFunc()
Magenta = color.New(color.F... | ycd/dstp | 1,294 | 🧪 Run common networking tests against any site. | Go | ycd | Yagiz Degirmenci | |
pkg/common/types.go | Go | package common
import (
"encoding/json"
"fmt"
"reflect"
"sync"
)
type Args []string
type Address string
type ResultPart struct {
Content string
Error error
}
func (o ResultPart) String() string {
if o.Error != nil {
return Red(o.Error.Error())
}
return o.Content
}
func (a Address) String() string {
... | ycd/dstp | 1,294 | 🧪 Run common networking tests against any site. | Go | ycd | Yagiz Degirmenci | |
pkg/dstp/addr.go | Go | package dstp
import (
"fmt"
"net"
"net/url"
"strings"
)
func getAddr(addr string) (string, error) {
var pu string
// Cleanup the scheme first
//
// [scheme:][//[userinfo@]host][/]path[?query][#fragment]
for _, prefix := range []string{"https://", "http://"} {
if strings.HasPrefix(addr, prefix) {
addr =... | ycd/dstp | 1,294 | 🧪 Run common networking tests against any site. | Go | ycd | Yagiz Degirmenci | |
pkg/dstp/addr_test.go | Go | package dstp
import (
"testing"
)
func TestGetAddr(t *testing.T) {
tests := []struct {
addrs []string
}{
{
addrs: []string{
"facebook.com",
"facebook.com:80",
"https://jvns.ca",
"https://jvns.ca:443",
"8.8.8.8",
"2606:4700:3031::ac43:b35a",
"meta.stackoverflow.com:443",
"htt... | ycd/dstp | 1,294 | 🧪 Run common networking tests against any site. | Go | ycd | Yagiz Degirmenci | |
pkg/dstp/dstp.go | Go | package dstp
import (
"context"
"crypto/tls"
"fmt"
"math"
"net"
"net/http"
"sync"
"time"
"github.com/ycd/dstp/config"
"github.com/ycd/dstp/pkg/common"
"github.com/ycd/dstp/pkg/lookup"
"github.com/ycd/dstp/pkg/ping"
)
// RunAllTests executes all the tests against the given domain, IP or DNS server.
func R... | ycd/dstp | 1,294 | 🧪 Run common networking tests against any site. | Go | ycd | Yagiz Degirmenci | |
pkg/dstp/dstp_test.go | Go | //go:build integration
package dstp
import (
"context"
"testing"
"github.com/ycd/dstp/config"
)
func TestRunAllTests(t *testing.T) {
ctx := context.Background()
c := config.Config{
Addr: "https://jvns.ca",
Output: "plaintext",
ShowHelp: false,
Timeout: 3,
PingCount: 3,
}
c1 := config.C... | ycd/dstp | 1,294 | 🧪 Run common networking tests against any site. | Go | ycd | Yagiz Degirmenci | |
pkg/dstp/dstp_unix.go | Go | //go:build !windows
package dstp
import (
"fmt"
)
func printWithColor(s string) {
fmt.Print(s)
}
| ycd/dstp | 1,294 | 🧪 Run common networking tests against any site. | Go | ycd | Yagiz Degirmenci | |
pkg/dstp/dstp_windows.go | Go | package dstp
import (
"fmt"
"github.com/fatih/color"
)
func printWithColor(s string) {
// https://pkg.go.dev/github.com/fatih/color@v1.13.0#readme-insert-into-noncolor-strings-sprintfunc
fmt.Fprint(color.Output, s)
}
| ycd/dstp | 1,294 | 🧪 Run common networking tests against any site. | Go | ycd | Yagiz Degirmenci | |
pkg/lookup/host.go | Go | package lookup
import (
"context"
"net"
"strings"
"sync"
"github.com/ycd/dstp/pkg/common"
)
func Host(ctx context.Context, wg *sync.WaitGroup, addr common.Address, customDnsServer string, result *common.Result) error {
defer wg.Done()
part := common.ResultPart{}
r := &net.Resolver{}
if customDnsServer !=... | ycd/dstp | 1,294 | 🧪 Run common networking tests against any site. | Go | ycd | Yagiz Degirmenci | |
pkg/lookup/host_test.go | Go | //go:build integration || darwin
package lookup
import (
"context"
"sync"
"testing"
"github.com/ycd/dstp/pkg/common"
)
func TestLookup(t *testing.T) {
var wg sync.WaitGroup
var result common.Result
wg.Add(1)
err := Host(context.Background(), &wg, common.Address("jvns.ca"), "8.8.8.8", &result)
if err != nil... | ycd/dstp | 1,294 | 🧪 Run common networking tests against any site. | Go | ycd | Yagiz Degirmenci | |
pkg/ping/dns.go | Go | package ping
import (
"context"
"fmt"
"sync"
"time"
"github.com/ycd/dstp/pkg/common"
)
func RunDNSTest(ctx context.Context, wg *sync.WaitGroup, addr common.Address, count int, timeout int, result *common.Result) error {
defer wg.Done()
part := common.ResultPart{}
pinger, err := createPinger(addr.String())
... | ycd/dstp | 1,294 | 🧪 Run common networking tests against any site. | Go | ycd | Yagiz Degirmenci | |
pkg/ping/ping.go | Go | package ping
import (
"bufio"
"bytes"
"context"
"fmt"
"log"
"os/exec"
"runtime"
"strings"
"sync"
"time"
"github.com/ycd/dstp/pkg/common"
)
func RunTest(ctx context.Context, wg *sync.WaitGroup, addr common.Address, count int, timeout int, result *common.Result) error {
return runPing(ctx, wg, addr, count,... | ycd/dstp | 1,294 | 🧪 Run common networking tests against any site. | Go | ycd | Yagiz Degirmenci | |
pkg/ping/ping_test.go | Go | //go:build integration || darwin || fallback
package ping
import (
"context"
"fmt"
"github.com/ycd/dstp/pkg/common"
"testing"
)
func TestPingFallback(t *testing.T) {
out, err := runPingFallback(context.Background(), common.Address("8.8.8.8"), 3)
if err != nil {
t.Fatal(err.Error())
}
fmt.Println(out.Strin... | ycd/dstp | 1,294 | 🧪 Run common networking tests against any site. | Go | ycd | Yagiz Degirmenci | |
pkg/ping/ping_unix.go | Go | //go:build !windows
package ping
import (
"github.com/go-ping/ping"
)
func createPinger(addr string) (*ping.Pinger, error) {
p, err := ping.NewPinger(addr)
return p, err
}
| ycd/dstp | 1,294 | 🧪 Run common networking tests against any site. | Go | ycd | Yagiz Degirmenci | |
pkg/ping/ping_windows.go | Go | //go:build windows
package ping
import (
"github.com/go-ping/ping"
)
func createPinger(addr string) (*ping.Pinger, error) {
p, err := ping.NewPinger(addr)
// https://pkg.go.dev/github.com/go-ping/ping#readme-windows
p.SetPrivileged(true)
return p, err
}
| ycd/dstp | 1,294 | 🧪 Run common networking tests against any site. | Go | ycd | Yagiz Degirmenci | |
src/api/handlers.rs | Rust | use std::{net::Ipv4Addr, str::FromStr, sync::Mutex};
use actix_web::{get, post, web, HttpResponse, Responder};
use serde::{Deserialize, Serialize};
use crate::{IpAndPath, Memory};
#[derive(Serialize)]
struct Health<T>
where
T: Into<String>,
{
status: T,
}
#[get("/health")]
pub async fn get_health() -> HttpR... | ycd/dur | 15 | 📮 Lightweight, high performance and configurable API rate limiter. | Rust | ycd | Yagiz Degirmenci | |
src/api/mod.rs | Rust | mod handlers;
pub use handlers::{get_health, new_request};
| ycd/dur | 15 | 📮 Lightweight, high performance and configurable API rate limiter. | Rust | ycd | Yagiz Degirmenci | |
src/backend/backend.rs | Rust | use std::{error::Error, net::Ipv4Addr, time::Duration};
use super::IpAndPath;
// Use the selected backend for storing related information
// about the API.
pub trait Backend {
fn new() -> Self;
fn clear(&mut self);
fn evict_older_timestamps(&mut self, id: u64, timestamp: Duration, window_time: u16);
f... | ycd/dur | 15 | 📮 Lightweight, high performance and configurable API rate limiter. | Rust | ycd | Yagiz Degirmenci | |
src/backend/memory.rs | Rust | use std::{
collections::HashMap,
error::Error,
net::Ipv4Addr,
time::{Duration, SystemTime},
};
use crate::Backend;
// In memory baceknd for dur
#[derive(Debug, Clone)]
pub struct Memory {
record: HashMap<u64, HashMap<Duration, IpAndPath>>,
}
#[derive(Debug, Clone)]
pub struct IpAndPath {
pub ip... | ycd/dur | 15 | 📮 Lightweight, high performance and configurable API rate limiter. | Rust | ycd | Yagiz Degirmenci | |
src/backend/mod.rs | Rust | mod backend;
mod memory;
pub use backend::Backend;
pub use memory::IpAndPath;
pub use memory::Memory;
| ycd/dur | 15 | 📮 Lightweight, high performance and configurable API rate limiter. | Rust | ycd | Yagiz Degirmenci | |
src/client.rs | Rust | use std::{net::Ipv4Addr, str::FromStr};
pub use clap::{App, Arg};
use crate::{
config::{Ip, Limits, Path},
Config,
};
static NAME: &str = "dur";
static VERSION: &str = env!("CARGO_PKG_VERSION");
static ABOUT: &str =
"dur, lightweight, stateless, configurable rate limiter with extremely high-performance";... | ycd/dur | 15 | 📮 Lightweight, high performance and configurable API rate limiter. | Rust | ycd | Yagiz Degirmenci | |
src/config/config.rs | Rust | use std::net::Ipv4Addr;
use serde::Deserialize;
use super::{Ip, Path};
#[derive(Debug, Clone, Deserialize)]
pub struct Config {
// The maximum limit for a user with the given id
// can send maximum request in a single period.
limit: u32,
// Maximum count of unique IP addresses
// that the same u... | ycd/dur | 15 | 📮 Lightweight, high performance and configurable API rate limiter. | Rust | ycd | Yagiz Degirmenci | |
src/config/ip.rs | Rust | use std::net::Ipv4Addr;
use serde::Deserialize;
#[derive(Debug, Clone, Deserialize)]
pub struct Ip {
ip_addresses: Option<Vec<Ipv4Addr>>,
limit: Option<u32>,
window_time: Option<u16>,
}
impl Ip {
#[allow(dead_code)]
pub fn new<I, T>(ip_addrs: I, limit: u32, window_time: u16) -> Self
where
... | ycd/dur | 15 | 📮 Lightweight, high performance and configurable API rate limiter. | Rust | ycd | Yagiz Degirmenci | |
src/config/mod.rs | Rust | mod config;
mod ip;
mod parser;
mod path;
pub use config::{Config, Limits};
pub use ip::Ip;
pub use path::Path;
| ycd/dur | 15 | 📮 Lightweight, high performance and configurable API rate limiter. | Rust | ycd | Yagiz Degirmenci | |
src/config/parser.rs | Rust | use std::{fs::File, io::Read};
use crate::Config;
impl Config {
pub fn from_path(path: String) -> Self {
let mut file = File::open(path).unwrap();
let mut contents = String::new();
file.read_to_string(&mut contents).unwrap();
let config: Config = toml::from_str(&contents).unwrap();... | ycd/dur | 15 | 📮 Lightweight, high performance and configurable API rate limiter. | Rust | ycd | Yagiz Degirmenci | |
src/config/path.rs | Rust | use serde::Deserialize;
#[derive(Debug, Clone, Deserialize)]
pub struct Path {
paths: Option<Vec<String>>,
limit: Option<u32>,
window_time: Option<u16>,
}
impl Path {
#[allow(dead_code)]
pub fn new<I, T>(endpoints: I, limit: u32, window_time: u16) -> Self
where
T: Into<String>,
... | ycd/dur | 15 | 📮 Lightweight, high performance and configurable API rate limiter. | Rust | ycd | Yagiz Degirmenci | |
src/dur.rs | Rust | use std::time::SystemTime;
use crate::{Backend, Config, IpAndPath};
#[derive(Debug, Clone)]
pub struct Dur<T> {
backend: T,
pub config: Config,
}
impl<T> Dur<T>
where
T: Backend,
{
pub fn new(backend: T, config: Option<Config>) -> Self {
Self {
backend: backend,
config... | ycd/dur | 15 | 📮 Lightweight, high performance and configurable API rate limiter. | Rust | ycd | Yagiz Degirmenci | |
src/helpers.rs | Rust | use actix_web::{web::Json, ResponseError};
use serde::Serialize;
/// Helper function to reduce boilerplate of an OK/Json response
#[allow(dead_code)]
pub fn respond_json<T>(data: T) -> Result<Json<T>, Box<dyn ResponseError>>
where
T: Serialize,
{
Ok(Json(data))
}
| ycd/dur | 15 | 📮 Lightweight, high performance and configurable API rate limiter. | Rust | ycd | Yagiz Degirmenci | |
src/main.rs | Rust | mod api;
mod backend;
mod client;
mod config;
mod dur;
mod helpers;
use std::sync::Mutex;
pub use backend::{Backend, IpAndPath, Memory};
pub use config::Config;
use actix_web::{web, App, HttpServer};
pub use dur::Dur;
#[actix_web::main]
async fn main() -> std::io::Result<()> {
let config = client::cli();
... | ycd/dur | 15 | 📮 Lightweight, high performance and configurable API rate limiter. | Rust | ycd | Yagiz Degirmenci | |
src/main.rs | Rust | mod rotator;
use std::process::exit;
use clap::{App, Arg};
use rotator::rotator::Rotator;
fn main() {
// Set level filter to minimum to log everything.
log::set_max_level(log::LevelFilter::Debug);
let matches = App::new("rotator")
.version("0.1")
.author("Yagiz Degirmenci. <yagizcanilbey... | ycd/ipv6-rotator | 22 | :twisted_rightwards_arrows: Rotate over ::/32 - ::/48 - ::/64 CIDR block of IPv6 addresses by randomly generating them. | Rust | ycd | Yagiz Degirmenci | |
src/rotator/mod.rs | Rust | pub mod rotator;
| ycd/ipv6-rotator | 22 | :twisted_rightwards_arrows: Rotate over ::/32 - ::/48 - ::/64 CIDR block of IPv6 addresses by randomly generating them. | Rust | ycd | Yagiz Degirmenci | |
src/rotator/rotator.rs | Rust | use std::{io::Stderr, process::exit, thread::sleep};
use rand::prelude::SliceRandom;
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum IpBlock {
CIDR32,
CIDR48,
CIDR64,
}
#[derive(Debug, PartialEq)]
pub struct Rotator<'a> {
pub device: &'a str,
pub sleep_time: u16,
pub block: IpBlock,
pub... | ycd/ipv6-rotator | 22 | :twisted_rightwards_arrows: Rotate over ::/32 - ::/48 - ::/64 CIDR block of IPv6 addresses by randomly generating them. | Rust | ycd | Yagiz Degirmenci | |
examples/main.py | Python | import ortoml
as_dict = {"test": "val", "test1": {"another": "dict"}}
# convert dict to toml string
as_toml = ortoml.dumps(as_dict)
# convert toml string to dictionary
# as_dict_again = ortoml.loads(as_toml)
# assert as_dict_again == as_dict, "Dictionaries are not matching"
| ycd/ortoml | 2 | [ABANDONED] Ultra fast, feature rich TOML library for Python written in Rust. | Rust | ycd | Yagiz Degirmenci | |
src/lib.rs | Rust | use std::{collections::HashMap, str::from_utf8};
use pyo3::wrap_pyfunction;
use pyo3::{prelude::*, types};
use toml;
#[pymodule]
fn ortoml(py: Python, m: &PyModule) -> PyResult<()> {
m.add_function(wrap_pyfunction!(dumps, m)?).unwrap();
m.add_function(wrap_pyfunction!(loads, m)?).unwrap();
m.add_function(... | ycd/ortoml | 2 | [ABANDONED] Ultra fast, feature rich TOML library for Python written in Rust. | Rust | ycd | Yagiz Degirmenci | |
src/main/scala/Result.scala | Scala | package result
/** Provides Rust Result<T,E> like interface for handling function results.
*/
sealed trait Result[+T, +E] extends Any {
// Returns the contained ['Ok'] value, consuming the 'self' value
@throws(classOf[RuntimeException])
def unwrap: T = this match {
case Ok(v) => v
case Err(e) =>
... | ycd/result.scala | 1 | A Rust like Result[+T, +E] type for Scala | Scala | ycd | Yagiz Degirmenci | |
src/main.rs | Rust | #![feature(proc_macro_hygiene, decl_macro)]
#![feature(option_unwrap_none)]
#[macro_use]
extern crate rocket;
extern crate woothee;
use log::info;
use response::Redirect;
use rocket::{response, State};
use rocket_contrib::json::Json;
use serde::{Deserialize, Serialize};
use utils::types::RequestHeaders;
use shortene... | ycd/sho.rs | 1 | An unreasonably high-performance, experimental URL shortener with strong-consistency model built on top of MongoDB | Rust | ycd | Yagiz Degirmenci | |
src/shortener/mod.rs | Rust | pub mod shortener;
pub mod url;
| ycd/sho.rs | 1 | An unreasonably high-performance, experimental URL shortener with strong-consistency model built on top of MongoDB | Rust | ycd | Yagiz Degirmenci | |
src/shortener/shortener.rs | Rust | use std::collections::HashMap;
use harsh::Harsh;
use mongodb::bson::doc;
use log::{error, info, warn};
use storage::storage::Storage;
use super::url::Url;
use crate::storage;
use mongodb::bson::{to_bson, Document};
use serde::Serialize;
pub struct Shortener {
pub id: u64,
pub generator: Harsh,
pub stora... | ycd/sho.rs | 1 | An unreasonably high-performance, experimental URL shortener with strong-consistency model built on top of MongoDB | Rust | ycd | Yagiz Degirmenci | |
src/shortener/url.rs | Rust | use mongodb::bson::{doc, to_bson, Document};
use serde::Serialize;
#[derive(Debug, Serialize)]
pub struct Url {
pub archived: bool,
pub created_at: chrono::DateTime<chrono::Utc>,
pub id: String,
pub link: String,
pub long_url: String,
}
impl Url {
pub fn new_record(id: String, long_url: Strin... | ycd/sho.rs | 1 | An unreasonably high-performance, experimental URL shortener with strong-consistency model built on top of MongoDB | Rust | ycd | Yagiz Degirmenci | |
src/storage/config.rs | Rust | use dotenv;
#[derive(Debug)]
pub struct Config {
pub server_ip: String,
pub dbname: String,
pub username: String,
pub password: String,
}
impl Config {
// Create a new Config for your MongoDB,
// Get's server_ip, dbname, username, password
// from the ".env" file
pub fn new() -> Result... | ycd/sho.rs | 1 | An unreasonably high-performance, experimental URL shortener with strong-consistency model built on top of MongoDB | Rust | ycd | Yagiz Degirmenci | |
src/storage/mod.rs | Rust | pub mod config;
pub mod storage;
| ycd/sho.rs | 1 | An unreasonably high-performance, experimental URL shortener with strong-consistency model built on top of MongoDB | Rust | ycd | Yagiz Degirmenci | |
src/storage/storage.rs | Rust | use super::config;
use mongodb::sync::{Client, Database};
// Storage represents mongodb client and the config for it.
pub struct Storage {
pub config: config::Config,
pub client: mongodb::sync::Client,
pub db: Database,
}
impl Storage {
pub fn new(db_name: &str) -> Storage {
let config = confi... | ycd/sho.rs | 1 | An unreasonably high-performance, experimental URL shortener with strong-consistency model built on top of MongoDB | Rust | ycd | Yagiz Degirmenci | |
src/utils/mod.rs | Rust | pub mod types;
| ycd/sho.rs | 1 | An unreasonably high-performance, experimental URL shortener with strong-consistency model built on top of MongoDB | Rust | ycd | Yagiz Degirmenci | |
src/utils/types.rs | Rust | use rocket::{
request::{FromRequest, Outcome},
Request,
};
use std::{collections::HashMap, convert::Infallible};
// Get request headers for any
// incoming HTTP requests.
#[derive(Debug)]
pub struct RequestHeaders {
pub headers: HashMap<String, String>,
}
impl<'a, 'r> FromRequest<'a, 'r> for RequestHeader... | ycd/sho.rs | 1 | An unreasonably high-performance, experimental URL shortener with strong-consistency model built on top of MongoDB | Rust | ycd | Yagiz Degirmenci | |
autoppt/__init__.py | Python | """
AutoPPT - AI-Powered Presentation Generator
"""
from .generator import Generator
from .config import Config
from .llm_provider import get_provider, BaseLLMProvider
from .researcher import Researcher
from .ppt_renderer import PPTRenderer
from .exceptions import AutoPPTError
__version__ = "0.4.0"
| yeasy/AutoPPT | 0 | Generate Professional Presentations in Seconds using latest AI. | Python | yeasy | Baohua Yang | |
autoppt/app.py | Python | #!/usr/bin/env python3
"""
AutoPPT Web Interface
A Streamlit-based web UI for generating AI-powered presentations.
Run with: streamlit run app.py
"""
import streamlit as st
import os
import tempfile
import time
from datetime import datetime
# Page configuration
st.set_page_config(
page_title="AutoPPT - AI Present... | yeasy/AutoPPT | 0 | Generate Professional Presentations in Seconds using latest AI. | Python | yeasy | Baohua Yang | |
autoppt/config.py | Python | import os
import logging
from dotenv import load_dotenv
load_dotenv()
# Configure logging for the entire application
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
datefmt='%Y-%m-%d %H:%M:%S'
)
logger = logging.getLogger(__name__)
class Config:
... | yeasy/AutoPPT | 0 | Generate Professional Presentations in Seconds using latest AI. | Python | yeasy | Baohua Yang | |
autoppt/data_types.py | Python | from pydantic import BaseModel, Field
from typing import List, Optional
from enum import Enum
class ChartType(str, Enum):
"""Supported chart types for PPT generation."""
BAR = "bar"
PIE = "pie"
LINE = "line"
COLUMN = "column"
class ChartData(BaseModel):
"""Data structure for chart generation... | yeasy/AutoPPT | 0 | Generate Professional Presentations in Seconds using latest AI. | Python | yeasy | Baohua Yang | |
autoppt/exceptions.py | Python | """
Custom exceptions for AutoPPT.
These exceptions provide user-friendly error messages and enable
structured error handling throughout the application.
"""
class AutoPPTError(Exception):
"""Base exception for all AutoPPT errors."""
pass
class APIKeyError(AutoPPTError):
"""Raised when an API key is mi... | yeasy/AutoPPT | 0 | Generate Professional Presentations in Seconds using latest AI. | Python | yeasy | Baohua Yang | |
autoppt/generator.py | Python | import os
import shutil
import logging
import time
from typing import Optional
from tqdm import tqdm
from .llm_provider import get_provider, BaseLLMProvider, MockProvider
from .researcher import Researcher
from .ppt_renderer import PPTRenderer
from .data_types import PresentationOutline, SlideConfig, UserPresentation... | yeasy/AutoPPT | 0 | Generate Professional Presentations in Seconds using latest AI. | Python | yeasy | Baohua Yang | |
autoppt/llm_provider.py | Python | import os
import logging
import time
from abc import ABC, abstractmethod
from typing import List, Type, TypeVar
from pydantic import BaseModel
from openai import OpenAI
from google import genai
from google.genai import types
from .exceptions import APIKeyError, RateLimitError
from .config import Config
logger = logg... | yeasy/AutoPPT | 0 | Generate Professional Presentations in Seconds using latest AI. | Python | yeasy | Baohua Yang | |
autoppt/main.py | Python | #!/usr/bin/env python3
"""
AutoPPT - AI-Powered Presentation Generator
Generate professional PowerPoint presentations using AI and real-time research.
"""
import argparse
import sys
import os
import logging
from .config import Config
from .exceptions import APIKeyError, RateLimitError
# Configure logging
logging.bas... | yeasy/AutoPPT | 0 | Generate Professional Presentations in Seconds using latest AI. | Python | yeasy | Baohua Yang | |
autoppt/ppt_renderer.py | Python | import os
import logging
from typing import Optional, List, Dict, Any
from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.dml.color import RGBColor
from pptx.chart.data import CategoryChartData
from pptx.enum.chart import XL_CHART_TYPE
from .data_types import UserPresentation, SlideConfig
logger... | yeasy/AutoPPT | 0 | Generate Professional Presentations in Seconds using latest AI. | Python | yeasy | Baohua Yang | |
autoppt/researcher.py | Python | import logging
import time
from typing import List, Dict, Optional
import requests
from ddgs import DDGS
from .config import Config
from .exceptions import ResearchError
logger = logging.getLogger(__name__)
class Researcher:
"""Research module for gathering web content and images."""
def __init__(self... | yeasy/AutoPPT | 0 | Generate Professional Presentations in Seconds using latest AI. | Python | yeasy | Baohua Yang | |
scripts/check_sensitive.py | Python | #!/usr/bin/env python3
"""
Safety check script for AutoPPT.
Checks for sensitive information (API keys, local paths) and unwanted files.
"""
import os
import sys
import re
import subprocess
# Patterns to search for
SENSITIVE_PATTERNS = [
(r"sk-[a-zA-Z0-9]{32,}", "Potential OpenAI/Anthropic API Key"),
(r"AIza[0... | yeasy/AutoPPT | 0 | Generate Professional Presentations in Seconds using latest AI. | Python | yeasy | Baohua Yang | |
scripts/generate_sample.py | Python | import sys
import os
# Add parent directory to path so we can import core
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from core.ppt_renderer import PPTRenderer
def generate_sample():
print("Generating sample PPT from hardcoded data...")
renderer = PPTRenderer()
... | yeasy/AutoPPT | 0 | Generate Professional Presentations in Seconds using latest AI. | Python | yeasy | Baohua Yang | |
scripts/install_hooks.py | Python | #!/usr/bin/env python3
"""
Installer for AutoPPT Git hooks.
Sets up the pre-commit hook to run safety audits automatically.
"""
import os
import stat
HOOK_CONTENT = """#!/bin/bash
echo "🛡️ Running pre-commit safety audit..."
python3 scripts/check_sensitive.py
if [ $? -ne 0 ]; then
echo "🚨 Commit aborted. Please ... | yeasy/AutoPPT | 0 | Generate Professional Presentations in Seconds using latest AI. | Python | yeasy | Baohua Yang | |
tests/__init__.py | Python | # Tests package
| yeasy/AutoPPT | 0 | Generate Professional Presentations in Seconds using latest AI. | Python | yeasy | Baohua Yang | |
tests/conftest.py | Python | """
Pytest configuration and shared fixtures for AutoPPT tests.
"""
import pytest
import os
import sys
import tempfile
import shutil
# Add project root to path
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
@pytest.fixture
def temp_dir():
"""Create a temporary directory for test ... | yeasy/AutoPPT | 0 | Generate Professional Presentations in Seconds using latest AI. | Python | yeasy | Baohua Yang | |
tests/test_data_types.py | Python | """
Unit tests for data types (Pydantic models).
"""
import pytest
from pydantic import ValidationError
from autoppt.data_types import (
ChartType,
ChartData,
SlideConfig,
PresentationSection,
PresentationOutline,
UserPresentation
)
class TestChartType:
"""Tests for ChartType enum."""
... | yeasy/AutoPPT | 0 | Generate Professional Presentations in Seconds using latest AI. | Python | yeasy | Baohua Yang | |
tests/test_llm_provider.py | Python | """
Unit tests for LLM providers.
"""
import pytest
from typing import List
from autoppt.llm_provider import (
BaseLLMProvider,
MockProvider,
get_provider
)
from autoppt.data_types import (
PresentationOutline,
PresentationSection,
SlideConfig
)
class TestMockProvider:
"""Tests for MockPr... | yeasy/AutoPPT | 0 | Generate Professional Presentations in Seconds using latest AI. | Python | yeasy | Baohua Yang | |
tests/test_renderer.py | Python | """
Unit tests for PPT renderer.
"""
import pytest
import os
import tempfile
from autoppt.ppt_renderer import PPTRenderer
from autoppt.data_types import ChartData, ChartType
class TestPPTRendererInit:
"""Tests for PPTRenderer initialization."""
def test_renderer_instantiation(self):
"""Test that... | yeasy/AutoPPT | 0 | Generate Professional Presentations in Seconds using latest AI. | Python | yeasy | Baohua Yang | |
tests/test_researcher.py | Python | """
Unit tests for Researcher module.
"""
import pytest
from unittest.mock import patch, MagicMock
from autoppt.researcher import Researcher
class TestResearcherInit:
"""Tests for Researcher initialization."""
def test_researcher_instantiation(self):
"""Test that Researcher can be instantiated."... | yeasy/AutoPPT | 0 | Generate Professional Presentations in Seconds using latest AI. | Python | yeasy | Baohua Yang | |
cmd/benchmark.go | Go | // Package cmd provides the command line interface logic for ask.
package cmd
import (
"fmt"
"os"
"text/tabwriter"
"time"
"github.com/spf13/cobra"
"github.com/yeasy/ask/internal/cache"
"github.com/yeasy/ask/internal/config"
"github.com/yeasy/ask/internal/github"
)
// benchmarkCmd represents the benchmark com... | yeasy/ask | 11 | The most powerful Package Manager for Agents Skills: search, query and install/uninstall in seconds! | HTML | yeasy | Baohua Yang | |
cmd/check.go | Go | package cmd
import (
"fmt"
"os"
"path/filepath"
"strings"
"github.com/fatih/color"
"github.com/spf13/cobra"
"github.com/yeasy/ask/internal/config"
"github.com/yeasy/ask/internal/skill"
)
// checkCmd represents the check command
var checkCmd = &cobra.Command{
Use: "check [skill-path]",
Short: "Check a ski... | yeasy/ask | 11 | The most powerful Package Manager for Agents Skills: search, query and install/uninstall in seconds! | HTML | yeasy | Baohua Yang | |
cmd/cmd_test.go | Go | package cmd
import (
"bytes"
"testing"
)
func TestRootCommand(t *testing.T) {
// Reset args before test
rootCmd.SetArgs([]string{"--help"})
var buf bytes.Buffer
rootCmd.SetOut(&buf)
rootCmd.SetErr(&buf)
err := rootCmd.Execute()
if err != nil {
t.Errorf("root command failed: %v", err)
}
output := buf.S... | yeasy/ask | 11 | The most powerful Package Manager for Agents Skills: search, query and install/uninstall in seconds! | HTML | yeasy | Baohua Yang | |
cmd/completion.go | Go | package cmd
import (
"os"
"strings"
"github.com/spf13/cobra"
"github.com/yeasy/ask/internal/cache"
"github.com/yeasy/ask/internal/config"
)
// completionCmd represents the completion command
var completionCmd = &cobra.Command{
Use: "completion [bash|zsh|fish|powershell]",
Short: "Generate shell completion s... | yeasy/ask | 11 | The most powerful Package Manager for Agents Skills: search, query and install/uninstall in seconds! | HTML | yeasy | Baohua Yang | |
cmd/create.go | Go | package cmd
import (
"fmt"
"os"
"regexp"
"github.com/spf13/cobra"
"github.com/yeasy/ask/internal/skill"
)
// createCmd represents the create command
var createCmd = &cobra.Command{
Use: "create <name>",
Short: "Create a new skill from a template",
Long: `Create a new skill directory with a standardized str... | yeasy/ask | 11 | The most powerful Package Manager for Agents Skills: search, query and install/uninstall in seconds! | HTML | yeasy | Baohua Yang | |
cmd/doctor.go | Go | package cmd
import (
"encoding/json"
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
"github.com/spf13/cobra"
"github.com/yeasy/ask/internal/cache"
"github.com/yeasy/ask/internal/config"
"github.com/yeasy/ask/internal/skill"
)
// DoctorResult represents the result of a health check
type DoctorResult struct ... | yeasy/ask | 11 | The most powerful Package Manager for Agents Skills: search, query and install/uninstall in seconds! | HTML | yeasy | Baohua Yang | |
cmd/doctor_test.go | Go | package cmd
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestDoctorCommand(t *testing.T) {
// Test that doctor command is registered
cmd := doctorCmd
assert.Equal(t, "doctor", cmd.Use)
assert.NotEmpty(t, cmd.Short)
assert.NotEmpty(t, cmd.Long)
}
func TestDoctorFlags(t *testing.T) {
// Test... | yeasy/ask | 11 | The most powerful Package Manager for Agents Skills: search, query and install/uninstall in seconds! | HTML | yeasy | Baohua Yang | |
cmd/gui.go | Go | package cmd
import (
"log"
"github.com/spf13/cobra"
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/options"
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
"github.com/yeasy/ask/internal/app"
"github.com/yeasy/ask/internal/server"
"github.com/yeasy/ask/internal/server/web"
)
var guiC... | yeasy/ask | 11 | The most powerful Package Manager for Agents Skills: search, query and install/uninstall in seconds! | HTML | yeasy | Baohua Yang |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.