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
html, | |
body { | |
height: 100%; | |
width: 100%; | |
padding: 0; | |
margin: 0; | |
background: #fafafa; | |
font-family: "Helvetica Neue", arial, sans-serif; | |
font-weight: 400; | |
color: #444; |
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 { h, Component } from "preact"; | |
import style from "./style"; | |
const apiKey = "YOUR_NEWS_API_KEY"; | |
export default class Home extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
error: null, |
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
// Default Precache for files generated by Preact.js | |
workbox.precaching.precacheAndRoute(self.__precacheManifest || []); | |
// Detect and register any fetch calls using 'https://' and use the Network First Strategy by Workbox | |
workbox.routing.registerRoute(/(?:https:\/\/.*)/,workbox.strategies.networkFirst()); | |
// Handle any images | |
workbox.routing.registerRoute( | |
// Cache image files | |
/.*\.(?:png|jpg|jpeg|svg|gif)/, |
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
git clone https://github.com/ChangoMan/Preact-Workbox.git preact-demo | |
cd preact-demo | |
npm install | |
npm run dev | |
# Navigate to http://localhost:8080 in your browser |
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
Slack Dark | |
(From Mac root) Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static | |
Edit file ssb-interop.js | |
Append this to bottom of file: | |
document.addEventListener('DOMContentLoaded', function() { | |
$.ajax({ |
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 React, { useReducer } from "react"; | |
/* Page With Chart Data */ | |
const pageWithChartState = { | |
loading: false, | |
error: false, | |
chartData: [], | |
filters: null | |
}; | |
function pageWithChartReducer(state, action) { |
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 { MetadataRoute } from 'next' | |
import { getAllArticles } from '@/lib/articles' | |
const WEBSITE_HOST_URL = process.env.SITE_URL || 'https://travelxfamily.com' | |
type changeFrequency = | |
| 'always' | |
| 'hourly' | |
| 'daily' | |
| 'weekly' |
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 meta = { | |
title: 'Travel x Family', | |
description: | |
'Travel x Family is a family friendly travel blog with an emphasis on food and adventure!', | |
image: `${WEBSITE_HOST_URL}/og-preview.jpg`, | |
} | |
export const metadata: Metadata = { | |
title: { | |
template: '%s - Travel x Family', |
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
'use server' | |
import { createServerActionClient } from '@supabase/auth-helpers-nextjs' | |
import { revalidatePath } from 'next/cache' | |
import { cookies } from 'next/headers' | |
export const updateAccount = async (formData: FormData, userId: string) => { | |
try { | |
const full_name = formData.get('full-name') | |
const username = formData.get('username') |
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
'use client' | |
import { Button } from '@/components/ui/button' | |
import { useCallback, useState } from 'react' | |
import { updateAccount } from '../actions' | |
type Profile = { | |
avatarUrl: string | |
email?: string | |
fullName: string | |
userId: string |