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/pages/index.js | JavaScript | import React from 'react'
import { graphql, Link } from 'gatsby'
function IndexPage({ data: { allGraphCmsPost } }) {
return (
<div className="divide-y divide-gray-200">
<div className="pt-6 pb-8 space-y-2 md:space-y-5">
<h1 className="text-3xl leading-9 font-extrabold text-gray-900 tracking-tight s... | ynnoj/2020-08-28-dynamic-content-in-gatsby | 2 | 📹 Dynamic content in Gatsby with Apollo Client | JavaScript | ynnoj | Jonathan Steele | stripe |
src/styles/index.css | CSS | @tailwind base;
@tailwind components;
@tailwind utilities;
| ynnoj/2020-08-28-dynamic-content-in-gatsby | 2 | 📹 Dynamic content in Gatsby with Apollo Client | JavaScript | ynnoj | Jonathan Steele | stripe |
src/templates/blog-post.js | JavaScript | import React from 'react'
import { graphql, Link } from 'gatsby'
import Img from 'gatsby-image'
import { MDXRenderer } from 'gatsby-plugin-mdx'
import { useQuery, gql } from '@apollo/client'
const COMMENTS_QUERY = gql`
query PostCommentsQuery($id: ID!) {
comments(where: { post: { id: $id } }) {
id
co... | ynnoj/2020-08-28-dynamic-content-in-gatsby | 2 | 📹 Dynamic content in Gatsby with Apollo Client | JavaScript | ynnoj | Jonathan Steele | stripe |
src/templates/default-page.js | JavaScript | import React from 'react'
import { MDXRenderer } from 'gatsby-plugin-mdx'
function DefaultPageTemplate({ pageContext: { page } }) {
return (
<div className="divide-y divide-gray-200">
<div className="pt-6 pb-8 space-y-2 md:space-y-5">
<h1 className="text-3xl leading-9 font-extrabold text-gray-900 t... | ynnoj/2020-08-28-dynamic-content-in-gatsby | 2 | 📹 Dynamic content in Gatsby with Apollo Client | JavaScript | ynnoj | Jonathan Steele | stripe |
tailwind.config.js | JavaScript | module.exports = {
purge: [],
theme: {
extend: {
lineHeight: {
'11': '2.75rem',
'12': '3rem',
'13': '3.25rem',
'14': '3.5rem',
},
},
},
variants: {},
plugins: [require('@tailwindcss/typography'), require('@tailwindcss/ui')],
}
| ynnoj/2020-08-28-dynamic-content-in-gatsby | 2 | 📹 Dynamic content in Gatsby with Apollo Client | JavaScript | ynnoj | Jonathan Steele | stripe |
lib/graphCmsClient.js | JavaScript | import { GraphQLClient } from 'graphql-request'
export default new GraphQLClient(process.env.GRAPHCMS_ENDPOINT, {
headers: {
Authorization: `Bearer ${process.env.GRAPHCMS_TOKEN}`,
},
})
| ynnoj/2020-11-17-nextjs-internationalized-routing | 3 | 📹 Internationalized routing with Next.js | JavaScript | ynnoj | Jonathan Steele | stripe |
next.config.js | JavaScript | module.exports = {
i18n: {
locales: ['en', 'de'],
defaultLocale: 'en',
},
}
| ynnoj/2020-11-17-nextjs-internationalized-routing | 3 | 📹 Internationalized routing with Next.js | JavaScript | ynnoj | Jonathan Steele | stripe |
pages/[id].js | JavaScript | import { gql } from 'graphql-request'
import graphCmsClient from '../lib/graphCmsClient'
function ProductPage({ product }) {
return <pre>{JSON.stringify(product, null, 2)}</pre>
}
export async function getStaticPaths({ locales }) {
let paths = []
const { products } = await graphCmsClient.request(gql`
{
... | ynnoj/2020-11-17-nextjs-internationalized-routing | 3 | 📹 Internationalized routing with Next.js | JavaScript | ynnoj | Jonathan Steele | stripe |
pages/_app.js | JavaScript | import Link from 'next/link'
import { useRouter } from 'next/router'
import '../styles/tailwind.css'
function App({ Component, pageProps }) {
const router = useRouter()
return (
<div>
<ul>
{router.locales.map((locale) => (
<li key={locale}>
<Link href={router.asPath} local... | ynnoj/2020-11-17-nextjs-internationalized-routing | 3 | 📹 Internationalized routing with Next.js | JavaScript | ynnoj | Jonathan Steele | stripe |
pages/index.js | JavaScript | import Link from 'next/link'
import { useRouter } from 'next/router'
import { gql } from 'graphql-request'
import graphCmsClient from '../lib/graphCmsClient'
function IndexPage({ products }) {
const router = useRouter()
return (
<div>
{products.map((product) => (
<div key={product.id}>
... | ynnoj/2020-11-17-nextjs-internationalized-routing | 3 | 📹 Internationalized routing with Next.js | JavaScript | ynnoj | Jonathan Steele | stripe |
postcss.config.js | JavaScript | module.exports = {
plugins: ['tailwindcss', 'postcss-preset-env'],
}
| ynnoj/2020-11-17-nextjs-internationalized-routing | 3 | 📹 Internationalized routing with Next.js | JavaScript | ynnoj | Jonathan Steele | stripe |
styles/tailwind.css | CSS | /* purgecss start ignore */
@tailwind base;
@tailwind components;
/* purgecss end ignore */
@tailwind utilities; | ynnoj/2020-11-17-nextjs-internationalized-routing | 3 | 📹 Internationalized routing with Next.js | JavaScript | ynnoj | Jonathan Steele | stripe |
tailwind.config.js | JavaScript | module.exports = {
future: {
removeDeprecatedGapUtilities: true,
purgeLayersByDefault: true,
},
purge: ['./pages/**/*.js'],
theme: {
extend: {},
},
variants: {},
plugins: [],
}
| ynnoj/2020-11-17-nextjs-internationalized-routing | 3 | 📹 Internationalized routing with Next.js | JavaScript | ynnoj | Jonathan Steele | stripe |
gatsby-node.js | JavaScript | exports.onPreBootstrap = ({ reporter }, pluginOptions) => {
if (!pluginOptions || !pluginOptions.clientId)
return reporter.panic(
'gatsby-plugin-smallchat: You must provide your Smallchat client ID'
)
}
| ynnoj/gatsby-plugin-smallchat | 0 | Plugin to add Smallchat to your Gatsby site | JavaScript | ynnoj | Jonathan Steele | stripe |
gatsby-ssr.js | JavaScript | import React from 'react'
export const onRenderBody = (
{ setPostBodyComponents },
{ async = true, clientId }
) => {
setPostBodyComponents([
<script
key="gatsby-plugin-smallchat"
src={`https://embed.small.chat/${clientId}.js`}
async={async}
/>
])
}
| ynnoj/gatsby-plugin-smallchat | 0 | Plugin to add Smallchat to your Gatsby site | JavaScript | ynnoj | Jonathan Steele | stripe |
index.js | JavaScript | // noop
| ynnoj/gatsby-plugin-smallchat | 0 | Plugin to add Smallchat to your Gatsby site | JavaScript | ynnoj | Jonathan Steele | stripe |
gatsby-node.js | JavaScript | exports.onPreBootstrap = ({ reporter }, pluginOptions) => {
if (!pluginOptions || !pluginOptions.accountId)
return reporter.panic(
'gatsby-plugin-vwo: You must provide your VWO account ID'
)
}
| ynnoj/gatsby-plugin-vwo | 0 | Plugin to add VWO to your Gatsby site | JavaScript | ynnoj | Jonathan Steele | stripe |
gatsby-ssr.js | JavaScript | import React from 'react'
export const onRenderBody = (
{ setHeadComponents },
{ accountId, async = true }
) => {
setHeadComponents([
<script
key="gatsby-plugin-vwo"
async={async}
dangerouslySetInnerHTML={{
__html: `
window._vwo_code = window._vwo_code || (function(){
... | ynnoj/gatsby-plugin-vwo | 0 | Plugin to add VWO to your Gatsby site | JavaScript | ynnoj | Jonathan Steele | stripe |
index.js | JavaScript | // noop
| ynnoj/gatsby-plugin-vwo | 0 | Plugin to add VWO to your Gatsby site | JavaScript | ynnoj | Jonathan Steele | stripe |
prettier.config.js | JavaScript | module.exports = {
semi: false,
singleQuote: true,
trailingComma: 'none',
}
| ynnoj/gatsby-plugin-vwo | 0 | Plugin to add VWO to your Gatsby site | JavaScript | ynnoj | Jonathan Steele | stripe |
example/gatsby-config.js | JavaScript | require(`dotenv`).config()
module.exports = {
plugins: [
{
resolve: `@moltin/gatsby-theme-moltin`,
options: {
clientId: process.env.MOLTIN_CLIENT_ID,
},
},
],
}
| ynnoj/gatsby-theme-moltin | 9 | 🛍 Gatsby theme for building Moltin powered eCommerce websites | JavaScript | ynnoj | Jonathan Steele | stripe |
demo/gatsby-config.js | JavaScript | require('dotenv').config()
module.exports = {
siteMetadata: {
title: 'JSNE Demo',
description: 'Gatsby demo for JavaScript NE',
},
plugins: [
'gatsby-plugin-react-helmet',
'gatsby-plugin-styled-components',
'gatsby-transformer-remark',
{
resolve: 'gatsby-source-contentful',
op... | ynnoj/jsne-talk-gatsby | 1 | 📣 Gatsby talk at JavaScript NE | ynnoj | Jonathan Steele | stripe | |
demo/gatsby-node.js | JavaScript | const path = require('path')
exports.createPages = ({ graphql, actions }) => {
const { createPage } = actions
return new Promise((resolve, reject) => {
graphql(`
{
allContentfulTalk {
edges {
node {
slug
}
}
}
}
`)
... | ynnoj/jsne-talk-gatsby | 1 | 📣 Gatsby talk at JavaScript NE | ynnoj | Jonathan Steele | stripe | |
demo/src/components/card.js | JavaScript | import React, { Component } from 'react'
import styled from 'styled-components'
const Card = styled.div`
border: 1px solid gray;
margin: 0 0.5rem;
padding: 1rem;
`
const Image = styled.div`
display: flex;
justify-content: center;
`
const Title = styled.h2`
color: #222;
`
export default class CardCompone... | ynnoj/jsne-talk-gatsby | 1 | 📣 Gatsby talk at JavaScript NE | ynnoj | Jonathan Steele | stripe | |
demo/src/components/event.js | JavaScript | import React from 'react'
import styled from 'styled-components'
import Card from '../components/card'
const Description = styled.p`
color: silver;
`
export default ({ event: { date, title } }) => (
<Card title={title}>
<Description>{date}</Description>
</Card>
)
| ynnoj/jsne-talk-gatsby | 1 | 📣 Gatsby talk at JavaScript NE | ynnoj | Jonathan Steele | stripe | |
demo/src/components/grid.js | JavaScript | import React from 'react'
import styled from 'styled-components'
const Grid = styled.div`
display: flex;
margin: 0 -0.5rem;
`
export default ({ children }) => <Grid>{children}</Grid>
| ynnoj/jsne-talk-gatsby | 1 | 📣 Gatsby talk at JavaScript NE | ynnoj | Jonathan Steele | stripe | |
demo/src/components/header.js | JavaScript | import React from 'react'
import Link from 'gatsby-link'
import styled from 'styled-components'
const Header = styled.header`
align-items: center;
background-color: rebeccapurple;
display: flex;
flex: auto;
justify-content: space-between;
padding: 1rem;
`
const Title = styled.h1`
color: white;
margin-... | ynnoj/jsne-talk-gatsby | 1 | 📣 Gatsby talk at JavaScript NE | ynnoj | Jonathan Steele | stripe | |
demo/src/components/item.js | JavaScript | import React from 'react'
import styled from 'styled-components'
const Item = styled.li`
list-style: none;
margin-bottom: 1rem;
`
export default ({ children }) => <Item>{children}</Item>
| ynnoj/jsne-talk-gatsby | 1 | 📣 Gatsby talk at JavaScript NE | ynnoj | Jonathan Steele | stripe | |
demo/src/components/layout.js | JavaScript | import React from 'react'
import Helmet from 'react-helmet'
import { graphql, StaticQuery } from 'gatsby'
import styled, { injectGlobal } from 'styled-components'
import Header from './header'
injectGlobal`
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, ... | ynnoj/jsne-talk-gatsby | 1 | 📣 Gatsby talk at JavaScript NE | ynnoj | Jonathan Steele | stripe | |
demo/src/components/list.js | JavaScript | import React from 'react'
import styled from 'styled-components'
const List = styled.ul`
margin: 0;
padding: 0;
`
export default ({ children }) => <List>{children}</List>
| ynnoj/jsne-talk-gatsby | 1 | 📣 Gatsby talk at JavaScript NE | ynnoj | Jonathan Steele | stripe | |
demo/src/components/speaker.js | JavaScript | import React from 'react'
import styled from 'styled-components'
import Card from '../components/card'
const Description = styled.p`
color: silver;
`
export default ({
speaker: {
avatar: {
sizes: { src: image },
},
description: {
childMarkdownRemark: { html: description },
},
name... | ynnoj/jsne-talk-gatsby | 1 | 📣 Gatsby talk at JavaScript NE | ynnoj | Jonathan Steele | stripe | |
demo/src/components/talk.js | JavaScript | import React from 'react'
import styled from 'styled-components'
import Card from '../components/card'
const Date = styled.p`
color: silver;
`
const Speaker = styled.p`
color: gray;
`
export default ({ talk: { date, title, speaker } }) => (
<Card title={title}>
<Speaker>{speaker.name}</Speaker>
<Date>... | ynnoj/jsne-talk-gatsby | 1 | 📣 Gatsby talk at JavaScript NE | ynnoj | Jonathan Steele | stripe | |
demo/src/components/title.js | JavaScript | import React from 'react'
import styled from 'styled-components'
const Title = styled.h2`
color: #333;
`
export default ({ title }) => <Title>{title}</Title>
| ynnoj/jsne-talk-gatsby | 1 | 📣 Gatsby talk at JavaScript NE | ynnoj | Jonathan Steele | stripe | |
demo/src/pages/index.js | JavaScript | import React from 'react'
import { graphql } from 'gatsby'
import Link from 'gatsby-link'
import styled from 'styled-components'
import Grid from '../components/grid'
import Layout from '../components/layout'
import Event from '../components/event'
import Title from '../components/title'
const StyledLink = styled(Lin... | ynnoj/jsne-talk-gatsby | 1 | 📣 Gatsby talk at JavaScript NE | ynnoj | Jonathan Steele | stripe | |
demo/src/pages/speakers.js | JavaScript | import React from 'react'
import { graphql } from 'gatsby'
import Link from 'gatsby-link'
import styled from 'styled-components'
import Grid from '../components/grid'
import Layout from '../components/layout'
import Speaker from '../components/speaker'
import Title from '../components/title'
const StyledLink = styled... | ynnoj/jsne-talk-gatsby | 1 | 📣 Gatsby talk at JavaScript NE | ynnoj | Jonathan Steele | stripe | |
demo/src/pages/talks.js | JavaScript | import React from 'react'
import { graphql } from 'gatsby'
import Link from 'gatsby-link'
import styled from 'styled-components'
import Grid from '../components/grid'
import Layout from '../components/layout'
import Talk from '../components/talk'
import Title from '../components/title'
const StyledLink = styled(Link)... | ynnoj/jsne-talk-gatsby | 1 | 📣 Gatsby talk at JavaScript NE | ynnoj | Jonathan Steele | stripe | |
demo/src/templates/event.js | JavaScript | import React from 'react'
import styled from 'styled-components'
import { graphql } from 'gatsby'
import Link from 'gatsby-link'
import Layout from '../components/layout'
import List from '../components/list'
import ListItem from '../components/item'
import Title from '../components/title'
const Event = styled.div`
... | ynnoj/jsne-talk-gatsby | 1 | 📣 Gatsby talk at JavaScript NE | ynnoj | Jonathan Steele | stripe | |
demo/src/templates/speaker.js | JavaScript | import React from 'react'
import styled from 'styled-components'
import { graphql } from 'gatsby'
import Link from 'gatsby-link'
import Layout from '../components/layout'
import List from '../components/list'
import ListItem from '../components/item'
import Title from '../components/title'
const Speaker = styled.div`... | ynnoj/jsne-talk-gatsby | 1 | 📣 Gatsby talk at JavaScript NE | ynnoj | Jonathan Steele | stripe | |
demo/src/templates/talk.js | JavaScript | import React from 'react'
import styled from 'styled-components'
import { graphql } from 'gatsby'
import Link from 'gatsby-link'
import Layout from '../components/layout'
import Title from '../components/title'
const Talk = styled.div`
margin-right: 2rem;
width: 70%;
`
const Meta = styled.div`
width: 30%;
`
e... | ynnoj/jsne-talk-gatsby | 1 | 📣 Gatsby talk at JavaScript NE | ynnoj | Jonathan Steele | stripe | |
client.js | JavaScript | module.exports = require('./dist/client').default
| ynnoj/next-stripe | 564 | Simplified server-side Stripe workflows in Next.js | JavaScript | ynnoj | Jonathan Steele | stripe |
index.js | JavaScript | module.exports = require('./dist/server')
| ynnoj/next-stripe | 564 | Simplified server-side Stripe workflows in Next.js | JavaScript | ynnoj | Jonathan Steele | stripe |
prettier.config.js | JavaScript | module.exports = {
semi: false,
singleQuote: true,
trailingComma: 'none',
}
| ynnoj/next-stripe | 564 | Simplified server-side Stripe workflows in Next.js | JavaScript | ynnoj | Jonathan Steele | stripe |
release.config.js | JavaScript | module.exports = {
branches: ['main', { name: 'beta', prerelease: true }]
}
| ynnoj/next-stripe | 564 | Simplified server-side Stripe workflows in Next.js | JavaScript | ynnoj | Jonathan Steele | stripe |
src/client/index.js | JavaScript | import fetcher from '../lib/fetcher'
async function confirmPaymentIntent(id, body) {
return await fetcher({
body: { id, body },
method: 'POST',
url: `/api/stripe/confirm/payment-intent`
})
}
async function createBillingPortalSession(body) {
return await fetcher({
body,
method: 'POST',
ur... | ynnoj/next-stripe | 564 | Simplified server-side Stripe workflows in Next.js | JavaScript | ynnoj | Jonathan Steele | stripe |
src/lib/fetcher.js | JavaScript | async function fetcher({ body, method = 'GET', url }) {
const res = await fetch(url, {
method,
headers: new Headers({ 'Content-Type': 'application/json' }),
...(body && { body: JSON.stringify(body) })
})
if (!res.ok) {
const error = new Error('An error occurred while performing this request.')
... | ynnoj/next-stripe | 564 | Simplified server-side Stripe workflows in Next.js | JavaScript | ynnoj | Jonathan Steele | stripe |
src/server/index.js | JavaScript | import * as routes from './routes'
async function NextStripeHandler(req, res, options) {
if (!req.query.nextstripe)
return res
.status(500)
.end(`Error: Cannot find [...nextstripe].js in pages/api/stripe`)
const [method, type] = req.query.nextstripe
if (method === 'confirm') {
switch (type)... | ynnoj/next-stripe | 564 | Simplified server-side Stripe workflows in Next.js | JavaScript | ynnoj | Jonathan Steele | stripe |
src/server/routes/confirm/payment-intent.js | JavaScript | import Stripe from 'stripe'
export default async function confirmPaymentIntent(req, res, options) {
try {
const stripe = new Stripe(options.stripe_key)
const { id, body } = req.body
const paymentIntent = await stripe.paymentIntents.confirm(id, body)
res.status(201).json(paymentIntent)
} catch ({... | ynnoj/next-stripe | 564 | Simplified server-side Stripe workflows in Next.js | JavaScript | ynnoj | Jonathan Steele | stripe |
src/server/routes/create/billing-portal-session.js | JavaScript | import Stripe from 'stripe'
export default async function createBillingPortalSession(req, res, options) {
try {
const stripe = new Stripe(options.stripe_key)
const session = await stripe.billingPortal.sessions.create(req.body)
res.status(201).json(session)
} catch ({ statusCode, raw: { message } }) {... | ynnoj/next-stripe | 564 | Simplified server-side Stripe workflows in Next.js | JavaScript | ynnoj | Jonathan Steele | stripe |
src/server/routes/create/checkout-session.js | JavaScript | import Stripe from 'stripe'
export default async function createCheckoutSession(req, res, options) {
try {
const stripe = new Stripe(options.stripe_key)
const session = await stripe.checkout.sessions.create(req.body)
res.status(201).json(session)
} catch ({ statusCode, raw: { message } }) {
res.s... | ynnoj/next-stripe | 564 | Simplified server-side Stripe workflows in Next.js | JavaScript | ynnoj | Jonathan Steele | stripe |
src/server/routes/create/payment-intent.js | JavaScript | import Stripe from 'stripe'
export default async function createPaymentIntent(req, res, options) {
try {
const stripe = new Stripe(options.stripe_key)
const paymentIntent = await stripe.paymentIntents.create(req.body)
res.status(201).json(paymentIntent)
} catch ({ statusCode, raw: { message } }) {
... | ynnoj/next-stripe | 564 | Simplified server-side Stripe workflows in Next.js | JavaScript | ynnoj | Jonathan Steele | stripe |
src/server/routes/index.js | JavaScript | // Confirm
export { default as confirmPaymentIntent } from './confirm/payment-intent'
// Create
export { default as createBillingPortalSession } from './create/billing-portal-session'
export { default as createCheckoutSession } from './create/checkout-session'
export { default as createPaymentIntent } from './create/pa... | ynnoj/next-stripe | 564 | Simplified server-side Stripe workflows in Next.js | JavaScript | ynnoj | Jonathan Steele | stripe |
src/server/routes/retrieve/payment-intent.js | JavaScript | import Stripe from 'stripe'
export default async function retrievePaymentIntent(req, res, options) {
try {
const stripe = new Stripe(options.stripe_key)
const paymentIntent = await stripe.paymentIntents.retrieve(req.body.id)
res.status(200).json(paymentIntent)
} catch ({ statusCode, raw: { message } ... | ynnoj/next-stripe | 564 | Simplified server-side Stripe workflows in Next.js | JavaScript | ynnoj | Jonathan Steele | stripe |
src/server/routes/update/payment-intent.js | JavaScript | import Stripe from 'stripe'
export default async function updatePaymentIntent(req, res, options) {
try {
const stripe = new Stripe(options.stripe_key)
const { id, body } = req.body
const paymentIntent = await stripe.paymentIntents.update(id, body)
res.status(200).json(paymentIntent)
} catch ({ s... | ynnoj/next-stripe | 564 | Simplified server-side Stripe workflows in Next.js | JavaScript | ynnoj | Jonathan Steele | stripe |
Fastfox.js | JavaScript |
/****************************************************************************************
* Fastfox *
* "Non ducor duco" *
* priority: speedy browsing ... | yokoffing/Betterfox | 10,046 | Firefox user.js for optimal privacy and security. Your favorite browser, but better. | JavaScript | yokoffing | ||
Peskyfox.js | JavaScript |
/****************************************************************************
* Peskyfox *
* "Aquila non capit muscas" *
* priority: remove annoyances *
* vers... | yokoffing/Betterfox | 10,046 | Firefox user.js for optimal privacy and security. Your favorite browser, but better. | JavaScript | yokoffing | ||
Securefox.js | JavaScript |
/****************************************************************************
* Securefox *
* "Natura non contristatur" *
* priority: provide sensible security and privacy *
*... | yokoffing/Betterfox | 10,046 | Firefox user.js for optimal privacy and security. Your favorite browser, but better. | JavaScript | yokoffing | ||
Smoothfox.js | JavaScript |
/****************************************************************************************
* Smoothfox *
* "Faber est suae quisque fortunae" *
* priority: better scrolling ... | yokoffing/Betterfox | 10,046 | Firefox user.js for optimal privacy and security. Your favorite browser, but better. | JavaScript | yokoffing | ||
install.py | Python | #!/usr/bin/env python3
from datetime import datetime
from os import name, getenv
from json import loads
from re import compile, IGNORECASE, sub
from pathlib import Path
from configparser import ConfigParser
from argparse import ArgumentParser
from shutil import copytree, ignore_patterns
from urllib.request import urlo... | yokoffing/Betterfox | 10,046 | Firefox user.js for optimal privacy and security. Your favorite browser, but better. | JavaScript | yokoffing | ||
personal/user-overrides.js | JavaScript |
/****************************************************************************
* *
* DISCLAIMER *
* *
* T... | yokoffing/Betterfox | 10,046 | Firefox user.js for optimal privacy and security. Your favorite browser, but better. | JavaScript | yokoffing | ||
user.js | JavaScript | //
/* You may copy+paste this file and use it as it is.
*
* If you make changes to your about:config while the program is running, the
* changes will be overwritten by the user.js when the application restarts.
*
* To make lasting changes to preferences, you will have to edit the user.js.
*/
/**********... | yokoffing/Betterfox | 10,046 | Firefox user.js for optimal privacy and security. Your favorite browser, but better. | JavaScript | yokoffing | ||
zen/user.js | JavaScript | //
/* You may copy+paste this file and use it as it is.
*
* If you make changes to your about:config while the program is running, the
* changes will be overwritten by the user.js when the application restarts.
*
* To make lasting changes to preferences, you will have to edit the user.js.
*/
/*******************... | yokoffing/Betterfox | 10,046 | Firefox user.js for optimal privacy and security. Your favorite browser, but better. | JavaScript | yokoffing | ||
Package.swift | Swift | // swift-tools-version:5.1
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "Stringly",
products: [
.executable(name: "stringly", targets: ["Stringly"]),
.library(name: "StringlyKit", targets... | yonaskolb/Stringly | 18 | Manage and generate localization files | Swift | yonaskolb | Yonas Kolb | |
Sources/Stringly/main.swift | Swift |
import Foundation
import SwiftCLI
import StringlyCLI
let cli = StringlyCLI()
let status = cli.run()
exit(status)
| yonaskolb/Stringly | 18 | Manage and generate localization files | Swift | yonaskolb | Yonas Kolb | |
Sources/StringlyCLI/CLI.swift | Swift | //
// File.swift
//
//
// Created by Yonas Kolb on 17/10/19.
//
import Foundation
import SwiftCLI
import PathKit
public class StringlyCLI {
let version = "0.9.0"
let cli: CLI
public init() {
cli = CLI(name: "stringly", version: version, description: "Generates localization files from a spec"... | yonaskolb/Stringly | 18 | Manage and generate localization files | Swift | yonaskolb | Yonas Kolb | |
Sources/StringlyCLI/Commands/GenerateCommand.swift | Swift | //
// File.swift
//
//
// Created by Yonas Kolb on 17/10/19.
//
import Foundation
import SwiftCLI
import StringlyKit
import PathKit
import Rainbow
class GenerateCommand: Command {
let name: String = "generate"
let shortDescription: String = "Generates all required localization files for a given platform"... | yonaskolb/Stringly | 18 | Manage and generate localization files | Swift | yonaskolb | Yonas Kolb | |
Sources/StringlyCLI/Commands/GenerateFileCommand.swift | Swift | //
// File.swift
//
//
// Created by Yonas Kolb on 17/10/19.
//
import Foundation
import SwiftCLI
import StringlyKit
import PathKit
import Yams
import TOMLDeserializer
import Rainbow
class GenerateFileCommand: Command {
let name: String = "generate-file"
let shortDescription: String = "Generates a specific... | yonaskolb/Stringly | 18 | Manage and generate localization files | Swift | yonaskolb | Yonas Kolb | |
Sources/StringlyCLI/FileType.swift | Swift | //
// File.swift
//
//
// Created by Yonas Kolb on 27/10/19.
//
import Foundation
import SwiftCLI
import PathKit
import StringlyKit
public enum FileType: String, ConvertibleFromString {
case strings
case stringsDict
case swift
init?(path: Path) {
switch path.extension?.lowercased() {
... | yonaskolb/Stringly | 18 | Manage and generate localization files | Swift | yonaskolb | Yonas Kolb | |
Sources/StringlyCLI/FileWriter.swift | Swift | //
// File.swift
//
//
// Created by Yonas Kolb on 27/10/19.
//
import Foundation
import PathKit
import SwiftCLI
import StringlyKit
public struct FileWriter {
public static func write(fileType: FileType, strings: StringGroup, language: String, destinationPath: Path?) throws {
do {
let gen... | yonaskolb/Stringly | 18 | Manage and generate localization files | Swift | yonaskolb | Yonas Kolb | |
Sources/StringlyCLI/GenerateError.swift | Swift | //
// File.swift
//
//
// Created by Yonas Kolb on 27/10/19.
//
import Foundation
import SwiftCLI
enum GenerateError: ProcessError {
case sourceParseError(Error)
case unstructuredContent
case missingSource
case encodingError(Error)
case writingError(Error)
case unknownFileType(String)
... | yonaskolb/Stringly | 18 | Manage and generate localization files | Swift | yonaskolb | Yonas Kolb | |
Sources/StringlyCLI/Loader.swift | Swift | //
// File.swift
//
//
// Created by Yonas Kolb on 27/10/19.
//
import Foundation
import StringlyKit
import TOMLDeserializer
import PathKit
import Yams
public struct Loader {
public static func loadStrings(from sourcePath: Path, baseLanguage: String) throws -> StringGroup {
if !sourcePath.exists {
... | yonaskolb/Stringly | 18 | Manage and generate localization files | Swift | yonaskolb | Yonas Kolb | |
Sources/StringlyCLI/PlatformType.swift | Swift | //
// File.swift
//
//
// Created by Yonas Kolb on 27/10/19.
//
import Foundation
import SwiftCLI
public enum PlatformType: String, ConvertibleFromString {
case apple
case android
}
| yonaskolb/Stringly | 18 | Manage and generate localization files | Swift | yonaskolb | Yonas Kolb | |
Sources/StringlyKit/Generator.swift | Swift | //
// File.swift
//
//
// Created by Yonas Kolb on 2/1/20.
//
import Foundation
public protocol Generator {
func generate(stringGroup: StringGroup, language: String) throws -> String
}
| yonaskolb/Stringly | 18 | Manage and generate localization files | Swift | yonaskolb | Yonas Kolb | |
Sources/StringlyKit/Generators/StringsDictGenerator.swift | Swift | //
// File.swift
//
//
// Created by Yonas Kolb on 22/10/19.
//
import Foundation
import Codability
struct StringsDict: Encodable {
var keys: [String: FormatKey]
func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: RawCodingKey.self)
for (key, format) in key... | yonaskolb/Stringly | 18 | Manage and generate localization files | Swift | yonaskolb | Yonas Kolb | |
Sources/StringlyKit/Generators/StringsGenerator.swift | Swift | //
// File.swift
//
//
// Created by Yonas Kolb on 22/10/19.
//
import Foundation
import Codability
public struct StringsGenerator: Generator {
public init() {}
public func generate(stringGroup: StringGroup, language: String) throws -> String {
let description = "// This file was auto-generated ... | yonaskolb/Stringly | 18 | Manage and generate localization files | Swift | yonaskolb | Yonas Kolb | |
Sources/StringlyKit/Generators/SwiftGenerator.swift | Swift | //
// File.swift
//
//
// Created by Yonas Kolb on 26/10/19.
//
import Foundation
public struct SwiftGenerator: Generator {
let namespace = "Strings"
var tableName: String { namespace }
public init() {}
public func generate(stringGroup: StringGroup, language: String) -> String {
let c... | yonaskolb/Stringly | 18 | Manage and generate localization files | Swift | yonaskolb | Yonas Kolb | |
Sources/StringlyKit/StringGroup.swift | Swift | //
// File.swift
//
//
// Created by Yonas Kolb on 17/10/19.
//
import Foundation
public struct StringGroup: Equatable {
public var path: [String] = []
public var groups: [StringGroup] = []
public var strings: [String: StringLocalization] = [:]
public var pathString: String { path.joined(separato... | yonaskolb/Stringly | 18 | Manage and generate localization files | Swift | yonaskolb | Yonas Kolb | |
Sources/StringlyKit/StringLocalization.swift | Swift | //
// File.swift
//
//
// Created by Yonas Kolb on 27/10/19.
//
import Foundation
public struct StringLocalization: Equatable {
public let languages: [String: Language]
public let placeholders: [Placeholder]
var defaultLanguage: Language {
languages["base"] ?? languages["en"]!
}
var ... | yonaskolb/Stringly | 18 | Manage and generate localization files | Swift | yonaskolb | Yonas Kolb | |
Tests/Fixtures/Strings.swift | Swift | // This file was auto-generated with https://github.com/yonaskolb/Stringly
// swiftlint:disable all
import Foundation
public enum Strings {
/// Ok
public static let ok = Strings.localized("ok")
public enum auth: StringGroup {
public static let localizationKey = "auth"
/// Email
... | yonaskolb/Stringly | 18 | Manage and generate localization files | Swift | yonaskolb | Yonas Kolb | |
Tests/StringlyCLITests/StringDiff.swift | Swift | import Foundation
// https://gist.github.com/kristopherjohnson/543687c763cd6e524c91
/// Find first differing character between two strings
///
/// :param: s1 First String
/// :param: s2 Second String
///
/// :returns: .DifferenceAtIndex(i) or .NoDifference
public func firstDifferenceBetweenStrings(_ s1: String, _ s2:... | yonaskolb/Stringly | 18 | Manage and generate localization files | Swift | yonaskolb | Yonas Kolb | |
Tests/StringlyCLITests/StringlyCLITests.swift | Swift | import XCTest
import StringlyCLI
import PathKit
final class StringlyTests: XCTestCase {
static let fixturePath = Path(#file).parent().parent() + "Fixtures"
static let stringsYamlPath = fixturePath + "Strings.yml"
func generateFileDiff(destination: Path, language: String = "en", file: StaticString = #fil... | yonaskolb/Stringly | 18 | Manage and generate localization files | Swift | yonaskolb | Yonas Kolb | |
Tests/StringlyCLITests/TestHelpers.swift | Swift | //
// File.swift
//
//
// Created by Yonas Kolb on 17/10/19.
//
import Foundation
import SwiftCLI
extension CLI {
static func capture(_ block: () -> ()) -> (String, String) {
let out = CaptureStream()
let err = CaptureStream()
Term.stdout = out
Term.stderr = err
block... | yonaskolb/Stringly | 18 | Manage and generate localization files | Swift | yonaskolb | Yonas Kolb | |
Tests/StringlyKitTests/StringlyKitTests.swift | Swift | import XCTest
import StringlyKit
import PathKit
final class StringlyTests: XCTestCase {
static let fixturePath = Path(#file).parent().parent() + "Fixtures"
static let yamlPath = fixturePath + "Strings.yml"
static let tomlPath = fixturePath + "Strings.toml"
static let stringsPath = fixturePath + "Strin... | yonaskolb/Stringly | 18 | Manage and generate localization files | Swift | yonaskolb | Yonas Kolb | |
Example/Example/App.swift | Swift | import SwiftUI
import SwiftComponent
@main
struct ExampleApp: App {
var body: some Scene {
WindowGroup {
ExamplesView()
}
}
}
struct MyPreviewProvider_Previews: PreviewProvider {
static var previews: some View {
ComponentListView(components: components)
}
}
| yonaskolb/SwiftComponent | 16 | Where architecture meets tooling | Swift | yonaskolb | Yonas Kolb | |
Example/Example/Components/Counter.component.swift | Swift | import Foundation
import SwiftComponent
import SwiftUI
@ComponentModel
struct CounterModel {
struct State: Equatable {
var count = 0
var displayingCount = true
}
enum Action {
case updateCount(Int)
case reset
}
func handle(action: Action) async {
switch ac... | yonaskolb/SwiftComponent | 16 | Where architecture meets tooling | Swift | yonaskolb | Yonas Kolb | |
Example/Example/Components/CounterCombine.component.swift | Swift | import Foundation
import SwiftComponent
import SwiftUI
@ComponentModel
struct CounterCombineModel {
struct State: Equatable {
var counter1 = CounterModel.State()
var counter2 = CounterModel.State()
var displayCount = true
}
}
struct CounterCombineView: ComponentView {
var mode... | yonaskolb/SwiftComponent | 16 | Where architecture meets tooling | Swift | yonaskolb | Yonas Kolb | |
Example/Example/Components/Item.component.swift | Swift | import SwiftUI
import SwiftComponent
@ComponentModel
struct ItemModel {
struct Connections {
let detail = Connection<ItemDetailModel>(output: .input(Input.detail))
.connect(state: \.detail)
let presentedDetail = Connection<ItemDetailModel>(output: .input(Input.detail))
... | yonaskolb/SwiftComponent | 16 | Where architecture meets tooling | Swift | yonaskolb | Yonas Kolb | |
Example/Example/Components/Resource.component.swift | Swift | import Foundation
import SwiftComponent
import SwiftUI
@ComponentModel
struct ResourceLoaderModel {
struct State {
@Resource var itemAutoload: Item?
@Resource var itemLoad: Item?
}
struct Item: Equatable {
var name: String
var count: Int
}
enum Action {
... | yonaskolb/SwiftComponent | 16 | Where architecture meets tooling | Swift | yonaskolb | Yonas Kolb | |
Example/Example/Examples.swift | Swift | import SwiftUI
import SwiftComponent
struct ExamplesView: View {
var body: some View {
NavigationStack {
Form {
NavigationLink("Counter") {
CounterView(model: ViewModel(state: .init()))
}
NavigationLink("Counter Combine") ... | yonaskolb/SwiftComponent | 16 | Where architecture meets tooling | Swift | yonaskolb | Yonas Kolb | |
Package.swift | Swift | // swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
import CompilerPluginSupport
var package = Package(
name: "SwiftComponent",
platforms: [.iOS(.v15), .macOS(.v12)],
products: [
.library(name: "Swif... | yonaskolb/SwiftComponent | 16 | Where architecture meets tooling | Swift | yonaskolb | Yonas Kolb | |
Plugins/SwiftComponentBuildPlugin/main.swift | Swift | import Foundation
import PackagePlugin
#if canImport(XcodeProjectPlugin)
import XcodeProjectPlugin
#endif
@main
struct ComponentBuilderPlugin {
func generateComponentsCommand(executable: Path, directory: Path, output: Path) -> Command {
.buildCommand(displayName: "Generate Component List",
... | yonaskolb/SwiftComponent | 16 | Where architecture meets tooling | Swift | yonaskolb | Yonas Kolb | |
Sources/SwiftComponent/ActionButton.swift | Swift | //
// File.swift
//
//
// Created by Yonas Kolb on 30/1/2023.
//
import Foundation
import SwiftUI
extension ViewModel {
public func button<Label: View>(_ action: @escaping @autoclosure () -> Model.Action, file: StaticString = #filePath, line: UInt = #line, @ViewBuilder label: () -> Label) -> some View {
... | yonaskolb/SwiftComponent | 16 | Where architecture meets tooling | Swift | yonaskolb | Yonas Kolb | |
Sources/SwiftComponent/Component.swift | Swift | import Foundation
import SwiftUI
public protocol Component: PreviewProvider {
associatedtype Model: ComponentModel
associatedtype ViewType: View
typealias PreviewModel = ComponentSnapshot<Model>
typealias Snapshots = [ComponentSnapshot<Model>]
typealias Snapshot = ComponentSnapshot<Model>
typ... | yonaskolb/SwiftComponent | 16 | Where architecture meets tooling | Swift | yonaskolb | Yonas Kolb | |
Sources/SwiftComponent/ComponentConnection.swift | Swift | import Foundation
import SwiftUI
import CasePaths
public struct ModelConnection<From: ComponentModel, To: ComponentModel> {
let id = UUID()
var output: OutputHandler<From, To>
var environment: Environment
var action: ActionHandler<From, To>?
var setDependencies: @MainActor (From, inout DependencyV... | yonaskolb/SwiftComponent | 16 | Where architecture meets tooling | Swift | yonaskolb | Yonas Kolb | |
Sources/SwiftComponent/ComponentDependencies.swift | Swift | import Foundation
import Dependencies
@dynamicMemberLookup
public class ComponentDependencies {
var dependencyValues: DependencyValues
var accessedDependencies: Set<String> = []
var setDependencies: Set<String> = []
let lock = NSLock()
init() {
dependencyValues = DependencyValues._current... | yonaskolb/SwiftComponent | 16 | Where architecture meets tooling | Swift | yonaskolb | Yonas Kolb | |
Sources/SwiftComponent/ComponentEnvironment.swift | Swift | import Foundation
public protocol ComponentEnvironment {
associatedtype Parent
var parent: Parent { get }
static var preview: Self { get }
/// provide a copy of the environment. If this is a class it must be a new instance. This is used for snapshots and test branch resets
func copy() -> Self
}
pu... | yonaskolb/SwiftComponent | 16 | Where architecture meets tooling | Swift | yonaskolb | Yonas Kolb | |
Sources/SwiftComponent/ComponentGraph.swift | Swift | import Foundation
@MainActor
class ComponentGraph {
var sendViewBodyEvents = false
private var storesByModelType: [String: [WeakRef]] = [:]
private var viewModelsByPath: [ComponentPath: WeakRef] = [:]
private var routes: [ComponentPath: Any] = [:]
let id = UUID()
init() {
}
fun... | yonaskolb/SwiftComponent | 16 | Where architecture meets tooling | Swift | yonaskolb | Yonas Kolb | |
Sources/SwiftComponent/ComponentModel.swift | Swift | import Foundation
import SwiftUI
import Combine
@MainActor
public protocol ComponentModel<State, Action>: DependencyContainer {
associatedtype State = Void
associatedtype Action = Never
associatedtype Input = Never
associatedtype Output = Never
associatedtype Route = Never
associatedtype Task:... | yonaskolb/SwiftComponent | 16 | Where architecture meets tooling | Swift | yonaskolb | Yonas Kolb | |
Sources/SwiftComponent/ComponentStore.swift | Swift | import Foundation
import SwiftUI
import Combine
import os
import Dependencies
@MainActor
class ComponentStore<Model: ComponentModel> {
enum StateStorage {
case root(Model.State)
case binding(StateBinding<Model.State>)
var state: Model.State {
get {
... | yonaskolb/SwiftComponent | 16 | Where architecture meets tooling | Swift | yonaskolb | Yonas Kolb | |
Sources/SwiftComponent/ComponentView.swift | Swift | import Foundation
import SwiftUI
import SwiftGUI
import SwiftPreview
import Perception
@MainActor
public protocol ComponentView: View, DependencyContainer {
associatedtype Model: ComponentModel
associatedtype ComponentView: View
associatedtype DestinationView: View
associatedtype Style = Never
typ... | yonaskolb/SwiftComponent | 16 | Where architecture meets tooling | Swift | yonaskolb | Yonas Kolb | |
Sources/SwiftComponent/Event.swift | Swift | import Foundation
import Combine
import SwiftUI
// TODO: remove
public class EventStore {
public static let shared = EventStore()
public internal(set) var events: [Event] = []
public let eventPublisher = PassthroughSubject<Event, Never>()
#if DEBUG
public var storeEvents = true
#else
publ... | yonaskolb/SwiftComponent | 16 | Where architecture meets tooling | Swift | yonaskolb | Yonas Kolb |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.