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 crypto from "crypto"; | |
import { renderToStaticMarkup } from "react-dom/server"; | |
import createMailgun from "mailgun-js"; | |
import type { ActionFunction, LoaderFunction, Session } from "remix"; | |
import { createCookieSessionStorage, json, redirect } from "remix"; | |
/******************************************************************************* | |
* Before we can do anything, we need to make sure the environment has | |
* everything we need. If anything is missing, we just prevent the app from | |
* starting up. |
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
extension Result where Failure == Error { | |
init(_ task: @escaping () async throws -> Success) async { | |
self = await withCheckedContinuation { [task] continuation in | |
Task { | |
do { | |
continuation.resume(returning: .success(try await task())) | |
} catch { | |
continuation.resume(returning: .failure(error)) | |
} | |
} |
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 UIKit | |
import SwiftUI | |
// Hacky workaround, use at your own risk and all that | |
struct BottomSheetPresenter<Content>: UIViewRepresentable where Content: View{ | |
let label: String | |
let content: Content | |
let detents: [UISheetPresentationController.Detent] | |
init(_ label: String, detents: [UISheetPresentationController.Detent], @ViewBuilder content: () -> Content) { |
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
##[[ | |
cflags '-I/usr/include/tensorflow' | |
linklib 'tensorflow' | |
cinclude '<tensorflow/c/c_api.h>' | |
]] | |
global TF_AttrType: type <cimport, nodecl, using> = @enum(cint){ | |
TF_ATTR_STRING = 0, | |
TF_ATTR_INT = 1, | |
TF_ATTR_FLOAT = 2, | |
TF_ATTR_BOOL = 3, |
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
<? | |
// | |
// AUTO KEYWORD-BASED FOLLOWER CURATION BOT (by @levelsio) | |
// | |
// File: twitterFollowerCuratorBot.php | |
// | |
// Created: May 2021 | |
// License: MIT | |
// |
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 Cocoa | |
import Foundation | |
class Person { | |
var age: Int | |
var name: String | |
init(age: Int, name: String) { | |
self.age = age | |
self.name = name |
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 ReactDOMServer from "react-dom/server"; | |
import type { EntryContext } from "@remix-run/core"; | |
import Remix from "@remix-run/react/server"; | |
import { renderToString } from "react-dom/server"; | |
import { ServerStyleSheet } from "styled-components"; | |
import StylesContext from "./stylesContext"; | |
export default function handleRequest( | |
request: Request, |
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
Show hidden characters
{ | |
// Snippits that make working with Twin a little easier | |
// https://github.com/ben-rogerson/twin.macro | |
"Add react import": { | |
"scope": "javascript,typescript,typescriptreact", | |
"prefix": "react", | |
"body": "import React from 'react'", | |
"description": "Add react import" | |
}, | |
"Add twin imports": { |
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 SwiftUI | |
enum PreviewProviderMode: CaseIterable { | |
/// Use for a light appearance preview. | |
case lightMode | |
/// Use for a dark appearance preview. | |
case darkMode | |
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 fetch = require('node-fetch'); | |
async function run() { | |
let username = "YOUR USERNAME HERE"; | |
let password = "YOUR APP PASSWORD"; | |
let authBasic = new Buffer(username + ':' + password).toString('base64'); | |
let session = await (await fetch('https://jmap.fastmail.com/.well-known/jmap', { | |
headers: { | |
"Authorization": "Basic " + authBasic | |
} | |
})).json(); |