This file contains hidden or 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 type { VNode, JSX } from "preact"; | |
| declare module "react" { | |
| export = React; | |
| export as namespace React; | |
| declare namespace React { | |
| type DetailedReactHTMLElement< | |
| P extends JSX.HTMLAttributes<T>, | |
| T extends HTMLElement |
This file contains hidden or 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 { createHmac } from "crypto"; | |
| const secret = process.env.SLACK_SIGNING_SECRET; | |
| export isValidRequestFromSlack = ({ headers, body }) => { | |
| return hasValidTimestamp({ headers }) && hasValidSignature({ headers, body }); | |
| }; | |
| const hasValidSignature = ({ headers, body }) => { | |
| if (!secret) return false; |
This file contains hidden or 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> | |
| import { onIntersect } from "./svelte-action-intersection-observer.js"; | |
| </script> | |
| <h2 class="animation-name" use:onIntersect={{ className: "-animated", once: true }}> | |
| Animated heading! | |
| </h2> |
This file contains hidden or 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> | |
| import { useState } from "./use-state"; | |
| const [count, setCount] = useState(0); | |
| </script> | |
| <p>{$count}</p> | |
| <button on:click={() => setCount(n => n + 1)}>+1</button> | |
| <button on:click={() => setCount(10)}>10</button> |
This file contains hidden or 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
| // 1. define secretKey previously(only A: your server and B: our server knows it) | |
| const SECRET_KEY = "XXX"; | |
| // 2. client prepare credential at A | |
| const timestamp = Date.now(); | |
| const credential = require("crypto") | |
| .createHmac("sha256", SECRET_KEY) | |
| .update(timestamp) | |
| .digest("base64"); |
This file contains hidden or 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
| { | |
| "name": "Remove unavailable tweets for TweetDeck", | |
| "version": "1.1", | |
| "description": "Do not show me, please.", | |
| "manifest_version": 2, | |
| "content_scripts": [ | |
| { | |
| "matches": ["https://tweetdeck.twitter.com/*"], | |
| "js": ["script.js"] | |
| } |
This file contains hidden or 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
| module.exports = { | |
| env: { | |
| es6: true, | |
| browser: true, | |
| jasmine: true, | |
| node: true | |
| }, | |
| settings: { | |
| react: { | |
| pragma: "h", |
This file contains hidden or 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
| class History { | |
| constructor(initialValue = null) { | |
| this._past = []; | |
| this._present = initialValue; | |
| this._future = []; | |
| } | |
| get value() { | |
| return this._present; | |
| } |
This file contains hidden or 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 { Readable } = require("stream"); | |
| const Discord = require("discord.js"); | |
| const client = new Discord.Client(); | |
| const TOKEN = "YOUR_TOKEN_HERE"; | |
| const SILENCE_FRAME = Buffer.from([0xF8, 0xFF, 0xFE]); | |
| class Silence extends Readable { | |
| _read() { | |
| this.push(SILENCE_FRAME); |
This file contains hidden or 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 { firefox, webkit, chromium } = require("playwright"); | |
| (async () => { | |
| // webkit x webkit can not be tested. no host-candidates appears by restriction | |
| const b1 = await setup(webkit); | |
| const b2 = await setup(firefox); | |
| const offer = await b1.page.evaluate(async () => { | |
| const pc = window.pc = new RTCPeerConnection(); | |
| const dc = window.dc = pc.createDataChannel("x"); |