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
export default function (blob: Blob, name: string) { | |
// Create object url | |
let data = window.URL.createObjectURL(blob) | |
// Create a element | |
let link = document.createElement('a') | |
// Add properties | |
link.href = data | |
link.download = 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
export default (url: string): Promise<HTMLImageElement> => { | |
// Promise | |
return new Promise((resolve, revoke) => { | |
// Image | |
let img = new Image() | |
// On load | |
img.onload = () => { | |
// Resolve | |
resolve(img) |
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
export const useCamera = () => { | |
// State | |
const cameraFacing = useState<ConstrainDOMString | undefined>("cameraFacing", () => 'environment') | |
const cameraStream = useState<MediaStream | undefined>("cameraStream", () => undefined) | |
// Start camera | |
// ---------- | |
const start = async () => { | |
// Promise | |
return new Promise(async (resolve, revoke) => { |
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
<template> | |
<div class="h-full rounded-full w-full" :style="conicGradient"></div> | |
</template> | |
<script setup> | |
// Props | |
const props = defineProps({ | |
color: { | |
type: String, | |
default: '#000000' |
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
<template> | |
<Transition :css="false" @before-enter="onBeforeEnter" @enter="onEnter" @before-leave="onBeforeLeave" @leave="onLeave" mode="out-in"> | |
<slot></slot> | |
</Transition> | |
</template> | |
<script> | |
import gsap from 'gsap' | |
export default { |
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
<template> | |
<div id="marquee"> | |
<div class="inner"> | |
<div class="message">{{ message }}</div> | |
<div class="message">{{ message }}</div> | |
</div> | |
</div> | |
</template> | |
<script setup> |
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 axios = require("axios") | |
const jwt = require("jsonwebtoken") | |
const handler = async (event) => { | |
try { | |
// Decode private key | |
const privateKey = Buffer.from(process.env.WEATHERKIT_KEY, 'base64').toString() | |
// Get team, key, and app id | |
const teamId = process.env.WEATHERKIT_TEAM_ID |
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
// Require file system module | |
const fs = require("fs") | |
// Read private key from file | |
const privateKey = fs.readFileSync("AuthKey_0000000000.p8").toString() | |
// Encode private key into Base64 string | |
const buff = Buffer.from(privateKey).toString('base64') |
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
<template> | |
<Transition :css="false" @before-enter="onBeforeEnter" @enter="onEnter" @leave="onLeave" mode="out-in"> | |
<slot></slot> | |
</Transition> | |
</template> | |
<script> | |
import gsap from 'gsap' | |
export default { |
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
let desaturate = (canvas) => { | |
// Get canvas image data | |
let imageData = canvas.getContext('2d').getImageData(0, 0, canvas.width, canvas.height) | |
// Get all pixels | |
let pixels = imageData.data | |
// Loop through pixels | |
for (let i = 0; i < pixels.length; i += 4) { | |
// Adjust lightness |
NewerOlder