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
{ | |
"keys": ["tab"], | |
"command": "expand_abbreviation_by_tab", | |
// put comma-separated syntax selectors for which | |
// you want to expandEmmet abbreviations into "operand" key | |
// instead of SCOPE_SELECTOR. | |
// Examples: source.js, text.html - source | |
"context": [ | |
{ |
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
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works | |
const axios = require('axios'); // promised based requests - like fetch() | |
function getCoffee() { | |
return new Promise(resolve => { | |
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee | |
}); | |
} |
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 Anthropic from '@anthropic-ai/sdk'; | |
import { Glob } from 'bun'; | |
export const anthropic = new Anthropic({ | |
apiKey: process.env.ANTHROPIC_KEY | |
}); | |
const glob = new Glob("./txt/*.txt"); | |
type Page = { |
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
function fixNotionPadding() { | |
Array.from(document.querySelectorAll(`[style*="padding-left: 96px"]`)).forEach(el => el.style.padding = 0); | |
requestAnimationFrame(fixNotionPadding); | |
} | |
fixNotionPadding(); |
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>🔥 Make a photo booth app in about 15 lines of JavaScript</title> | |
<link rel="icon" href="https://fav.farm/🎥" /> | |
</head> | |
<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
// put this in a file where your service worker used to live, like yourdomain.com/service-worker.js. You can find out this path in the SW dev tools of your browser | |
self.addEventListener('install', (e) => { | |
console.log('[Service Worker] Installing Service Worker ...', e); | |
self.skipWaiting(); | |
}); | |
self.addEventListener('activate', (e) => { | |
console.log('[ServiceWorker] Activate'); | |
self.registration |
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
"workbench.editor.customLabels.patterns": { | |
"**/routes/**/+page.svelte": "${dirname(1)}/${dirname}", | |
"**/routes/**/+page.server.ts": "/${dirname} [server]", | |
"**/app/**/page.tsx": "${dirname}.${extname}", | |
"**/app/**/layout.tsx": "${dirname}/layout.${extname}" | |
} |
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 like this: node --import logger.js yourapp.js | |
import path from 'path'; | |
const { log } = console; | |
[`debug`, `log`, `warn`, `error`, `table`, `dir`].forEach((methodName) => { | |
const originalLoggingMethod = console[methodName]; | |
console[methodName] = (...args) => { | |
const originalPrepareStackTrace = Error.prepareStackTrace; | |
Error.prepareStackTrace = (_, stack) => stack; |
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
function is_blog () { | |
global $post; | |
$posttype = get_post_type($post ); | |
return ( ((is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag())) && ( $posttype == 'post') ) ? true : false ; | |
} | |
Usage: | |
<?php if (is_blog()) { echo 'You are on a blog page'; } ?> |
NewerOlder