Top HN posts
| <?php | |
| /* | |
| A simple PHP class to perform basic operations against Amazon S3 and compatible | |
| services. Requires modern PHP (7+, probably) with curl, dom, and iconv modules. | |
| Copyright 2022 Marco Arment. Released under the MIT license: | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights |
Sometimes you need to publish a CSS file for 3rd-party consumption (i.e. default styles for an embeddable JS widget). This set up lets you continue to use Tailwind, but scope all your styles to a specific selector.
Simply replace .internachi with your own widget namespace, set up Tailwind as you please,
and run generate.sh to build a custom version of your Tailwind styles that won't interfere
with other CSS rules (including the Tailwind reset).
| /* | |
| Made by Elly Loel - https://ellyloel.com/ | |
| With inspiration from: | |
| - Josh W Comeau - https://courses.joshwcomeau.com/css-for-js/treasure-trove/010-global-styles/ | |
| - Andy Bell - https://piccalil.li/blog/a-modern-css-reset/ | |
| - Adam Argyle - https://unpkg.com/[email protected]/normalize.min.css / https://codepen.io/argyleink/pen/KKvRORE | |
| Notes: | |
| - `:where()` is used to lower specificity for easy overriding. | |
| */ |
| const initialState = { | |
| activated: false, | |
| resolve: () => {}, | |
| }; | |
| function useSignal() { | |
| const [state, setState] = useState(initialState); | |
| function init() { | |
| return new Promise((resolve) => { |
Integrate Google Sign-in (Popup method) with Nuxt.js - Works in Incognito mode as well
Nuxt 3 version here.
export default {
...| /* Ultra lightweight Github REST Client */ | |
| // original inspiration via https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb | |
| const token = 'github-token-here' | |
| const githubClient = generateAPI('https://api.github.com', { | |
| headers: { | |
| 'User-Agent': 'xyz', | |
| 'Authorization': `bearer ${token}` | |
| } | |
| }) |
A Vue composable which finds the first element matched by a selector, using useMutationObserver (i.e. requires the @vueuse/core package).
While using template refs is the canonical way to access elements in Vue, there may be situations (e.g. when you wrap non-Vue code you have no control over) where using raw DOM access may be needed.
import { watchEffect } from 'vue'| import { preprocess } from 'svelte/compiler' | |
| /** | |
| * @typedef {import("svelte/types/compiler/preprocess").PreprocessorGroup} PreprocessorGroup | |
| * @param {PreprocessorGroup[]} preprocessors | |
| * @returns {PreprocessorGroup[]} | |
| */ | |
| export function sequence(preprocessors) { | |
| return preprocessors.map((preprocessor) => ({ | |
| markup({ content, filename }) { |