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
<script> | |
// Note: This is a waste of JavaScipt resources, and will not update nicely | |
// if you are running heavy computations. Better to use an SVG or CSS. | |
import { onMount } from "svelte" | |
const fullString = "..." | |
let currentString = "" | |
onMount(() => { |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>My Tests</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgo="> | |
<link rel="stylesheet" href="node_modules/mocha/mocha.css" /> | |
<script type="module" src="node_modules/mocha/mocha.js"></script> | |
<script type="module"> |
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
// this file uses eslint's new "flat configuration" format: | |
// https://eslint.org/docs/latest/use/configure/configuration-files-new | |
// as of now, there are not many resources online on how to use it. | |
import js from "@eslint/js" | |
import globals from 'globals' | |
import sveltePlugin from 'eslint-plugin-svelte' | |
import svelteParser from 'svelte-eslint-parser' | |
import { js as myJsRules, svelte as mySvelteRules } from "./my-eslint-rules.js" |
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 GoogleSheets = require('@googleapis/sheets'); | |
const GoogleLogging = require('@google-cloud/logging'); | |
// both google services below are authenticated via "Application Default Credentials" (ADC) | |
// https://googleapis.dev/nodejs/googleapis/latest/sheets/index.html#service-account-credentials | |
// this will automatically read contents of service account key json file | |
// as specified at path by environment variable GOOGLE_APPLICATION_CREDENTIALS. | |
// it would also be possible to specify path programmatically. | |
// steps to enable service account on google cloud: |
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 = (...args) => import('node-fetch').then(({ default: fetch }) => fetch(...args)); | |
module.exports = { | |
subscribe: async (emailAddress) => { | |
const { | |
SENDY_API_KEY: apiKey, | |
SENDY_LIST_ID: listId, | |
SENDY_SUBSCRIBE_URL: url, | |
} = process.env; | |
const body = { |
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
// | |
// TableViewDataSource.swift | |
// | |
import UIKit | |
////////////////////////////// | |
// Project code | |
////////////////////////////// |
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 | |
extension UIStackView { | |
/// [Source](https://www.iamsim.me/uistackview-left-align-without-stretching/) | |
public func alignArrangedSubviewsToLeft() { | |
increaseArrangedSubviewsContentHuggingPriority() | |
let stretchingView = getStretchingViewWithLowContentHuggingPriority() |
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
/// If an error occurs while getting the amount of memory used, the first returned value in the tuple will be 0. | |
func getMemoryUsedAndDeviceTotalInMegabytes() -> (Float, Float) { | |
// https://stackoverflow.com/questions/5887248/ios-app-maximum-memory-budget/19692719#19692719 | |
// https://stackoverflow.com/questions/27556807/swift-pointer-problems-with-mach-task-basic-info/27559770#27559770 | |
var used_megabytes: Float = 0 | |
let total_bytes = Float(ProcessInfo.processInfo.physicalMemory) |
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 admin = require('firebase-admin'); | |
function buildHtmlWithPost (post) { | |
const string = '<!DOCTYPE html><head>' \ | |
'<title>' + post.title + ' | Example Website</title>' \ | |
'<meta property="og:title" content="' + post.title + '">' \ | |
'<meta property="twitter:title" content="' + post.title + '">' \ | |
'<link rel="icon" href="https://example.com/favicon.png">' \ | |
'</head><body>' \ | |
'<script>window.location="https://example.com/?post=' + post.id + '";</script>' \ |
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 admin = require('firebase-admin'); | |
function buildHtmlWithPost (post) { | |
const title = post.title + ' | Example Website'; | |
var head = { | |
title: title, | |
meta: [ | |
// This may not be a valid combination of tags for the services you need to support; |
NewerOlder