Skip to content

Instantly share code, notes, and snippets.

View shinokada's full-sized avatar

Shinichi Okada shinokada

View GitHub Profile
<script lang='ts'>
import "../app.postcss"
import { Navbar, NavBrand, NavLi, NavUl, NavHamburger, Footer, FooterBrand, FooterCopyright, FooterLinkGroup, FooterLink, Hr } from 'flowbite-svelte'
</script>
<Navbar let:hidden let:toggle>
<NavBrand href="/">
<img
src="https://flowbite-svelte.com/images/flowbite-svelte-icon-logo.svg"
class="mr-3 h-6 sm:h-9"
<script lang='ts'>
import "../app.postcss"
import { Navbar, NavBrand, NavLi, NavUl, NavHamburger } from 'flowbite-svelte'
</script>
<Navbar let:hidden let:toggle>
<NavBrand href="/">
<img
src="https://flowbite-svelte.com/images/flowbite-svelte-icon-logo.svg"
class="mr-3 h-6 sm:h-9"
/*
Use this with the following script
```
"write-package-json": "node ./scripts/package-json-writer.js",
"add-exports": "node ./scripts/add-exports-to-package-json.js",
"package:publish": "standard-version && git push --follow-tags origin main && npm run package &&
npm run add-exports && npm run write-package-json && npm publish",
```
This script reads the content of a folder named 'dist' and generates an exports object to be included in the
// reference https://dev.to/builderio/safe-data-fetching-in-modern-javascript-dp4
class ResponseError extends Error {
constructor(message, res) {
super(message)
this.response = res
}
}
export async function myFetch(...options) {
<%- include('partials/header',{title:title}); %>
<h1 class="text-4xl font-bold dark:text-white py-8">
<%= title %>
</h1>
<h2 class="text-3xl dark:text-white py-4">Examples</h2>
<div class="flex flex-wrap justify-between">
<div class="my-4 max-w-sm p-6 bg-white border border-gray-200 rounded-lg shadow-md dark:bg-gray-800 dark:border-gray-700">
<a href="/location">
// src/worldcities.js
import { client } from './redis.js';
export const addIntCities = () => {
client.geoadd('cities', 0.0000, 0.0000, "North Pole");
client.geoadd('cities', -0.1278, 51.5074, "London");
client.geoadd('cities', -3.7032, 40.4168, "Madrid");
client.geoadd('cities', -77.0369, 38.9072, "Washington D.C.");
client.geoadd('cities', 139.6917, 35.6895, "Tokyo")
// src/uscities.js
import { client } from './redis.js';
export const addUsCities = () => {
client.geoadd('uscities', -71.0589, 42.3601, "Boston, Massachusetts");
client.geoadd('uscities', -75.1652, 39.9526, "Philadelphia, Pennsylvania");
client.geoadd('uscities', -112.0740, 33.4484, "Phoenix, Arizona");
client.geoadd('uscities', -98.4936, 29.4241, "San Antonio, Texas");
client.geoadd('uscities', -121.8949, 37.3382, "San Jose, California");
client.geoadd('uscities', -97.7431, 30.2672, "Austin, Texas");
<script lang="ts">
import '../app.postcss';
import { page } from '$app/stores';
import { onMount } from 'svelte';
import {
Navbar,
NavBrand,
NavLi,
NavUl,
NavHamburger,
  1. Replace all spaces with underscores
replaceit
  1. Convert pdf to png files
pdftoimg -s -w 288
// see express-debugging https://gist.github.com/shinokada/3d2f7fd48b9ea9a75349fd4bad3c617d
{
"name": "code",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "DEBUG=app nodemon app.js",
"debug": "DEBUG=* nodemon app.js",
"test": "echo \"Error: no test specified\" && exit 1"