Skip to content

Instantly share code, notes, and snippets.

View codebender828's full-sized avatar
⚡️
Writing history

Jonathan Bakebwa codebender828

⚡️
Writing history
View GitHub Profile
@segunadebayo
segunadebayo / ideas.md
Last active October 2, 2021 13:00
Ideas for Static CSS Generation of JSX Style Props
// Button.js => Button.css
import { chakra } from "@chakra-ui/magic";
import "@chakra-ui/css/Button.css";

<chakra.button mb="2" mt="2" _hover={{ bg: "red.200", _focus: {} }} />;

<button css={{mb: "2", mt="2", _hover: { bg: "red.200", _focus: {} }} />

const result = interpret(
@yyx990803
yyx990803 / exampe-config.js
Created January 13, 2021 02:58
A vite plugin that loads the specified deps over CDN during dev, and downloads/includes them into bundle during build.
// example vite.config.js
import { cdn } from './vite-plugin-cdn'
export default {
plugins: [
// also supported: esm.run, jspm
// loads the dep over the CDN during dev
// auto downloads and includes into the bundle during build
cdn('skypack', {
vue: '^3.0.5'
@codebender828
codebender828 / gist:87b901869d333b234fc55eb50bd6ef68
Last active October 30, 2021 06:42
📊 Weekly codebending breakdown
We couldn’t find that file to show.
@yyx990803
yyx990803 / svelte.js
Last active December 8, 2019 09:18
Svelte/Vue generated code size comparison of the TodoMVC implementation. Note: (1) imports are replaced with a const declaration to enable compression. (2) The comparison is between components' "own code" and doesn't include imported runtime code.
/* App.svelte generated by Svelte v3.14.1 */
/* After terser compression: min:6.00kb / gzip:2.43kb / brotli:2.15kb */
const {
SvelteComponent,
append,
attr,
destroy_block,
detach,
element,
empty,
@nzvtrk
nzvtrk / axiosInterceptor.js
Last active December 7, 2023 17:21
Axios create/recreate cookie session in node.js enviroment
/* Basic example of saving cookie using axios in node.js and session's recreation after expiration.
* We have to getting/saving cookie manually because WithCredential axios param use XHR and doesn't work in node.js
* Also, this example supports parallel request and send only one create session request.
* */
const BASE_URL = "https://google.com";
// Init instance of axios which works with BASE_URL
const axiosInstance = axios.create({ baseURL: BASE_URL });
@TheLarkInn
TheLarkInn / captureWebRTCAudio.js
Last active January 31, 2019 15:29
Record that voice! Just learning MediaRecorder API's
const captureWebRTCAudio = (successHandler) => {
return navigator.mediaDevices.getUserMedia({audio: true, video: false}).then(successHandler);
};
export default captureWebRTCAudio;
@egeorjon
egeorjon / add_remove_class_with_js.md
Last active October 13, 2023 23:06
Add or Remove css class with Javascript

From: StackOverflow

To change all classes for an element:

document.getElementById("MyElement").className = "MyClass";

To add an additional class to an element:

document.getElementById("MyElement").className += " MyClass";

To remove a class from an element: