Skip to content

Instantly share code, notes, and snippets.

@kepano
kepano / obsidian-web-clipper.js
Last active July 28, 2024 19:48
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
@samselikoff
samselikoff / authed-swr-provider.js
Created July 19, 2021 04:32
Example useAuth hook using Zustand, SWR and Suspense
import firebase from "firebase/app";
import "firebase/auth";
import { gql, GraphQLClient } from "graphql-request";
import { SWRConfig } from "swr";
import create from "zustand";
import { computed } from "zustand-middleware-computed-state";
const firebaseConfig = {
//
};
@ben-rogerson
ben-rogerson / App.js
Last active March 29, 2024 07:50
A breakpoint provider that syncs up with your screens in tailwind.config.js. Common use is to fully remove elements from the dom rather than hide them with css.
import React from 'react';
import { useMinScreen } from './minScreen';
const App = () => {
const { min } = useMinScreen();
return (
<>
{min`md` && <div>I'll show at md and up</div>}
{!min`lg` && <div>I'll show at up to lg</div>}
@benknight
benknight / README.md
Last active August 16, 2023 04:59
[use-carousel] Headless UI React hook for building a scroll-based carousel

[use-carousel] Headless UI React hook for building a scroll-based carousel

BYO-UI. No CSS necessary. Inspired by react-table.

Usage:

const {
  getLeftNavProps,
 getRightNavProps,
@ryanb
ryanb / 1_create_nodes_migration.rb
Last active February 27, 2024 13:14
A variation of closure_tree with support for multiple parents
class CreateNodes < ActiveRecord::Migration[6.0]
def change
create_table :nodes do |t|
end
create_table :node_edges do |t|
t.integer :parent_id, null: false
t.integer :child_id, null: false
end
@waszil
waszil / hide_traceback.py
Created July 8, 2020 07:46
Disable traceback printing temporarily in python
from contextlib import contextmanager
@contextmanager
def hide_traceback() -> None:
def is_running_from_ipython() -> bool:
""" Checks whether running in IPython interactive console or not """
try:
import IPython
except ImportError:
@j-mai
j-mai / README.md
Last active July 22, 2024 19:19
A guide for using Unity and Git

Using Git with Unity

What are the problems?

  • Noise: Unity editor has lots of temporary files that we don’t want git to track
  • Broken object references: Unity keeps track of objects created by using random GUIDs, and if they aren’t tracked using .meta files then there can be conflicts that really break your project
  • Unresolvable merge conflicts: files like scene files that are written in confusing languages (like YAML) that are supposed to be translations of Unity editor actions into code. Most likely, you cannot resolve using Git, and the only way to resolve merge conflicts is to open it in a text editor and resolve them manually while hoping you don't mess anything up because these files are confusing and not meant to be manipulated directly.
  • Large files: Sometimes assets are large and take up a lot of storage space

💻 Project Setup

@ShinyChang
ShinyChang / README.MD
Last active January 9, 2022 14:11
Codesandbox sublime keymap
  1. Create new sandbox on codesandbox
  2. Press Cmd+Shift+P and choose >Preferences: Open Keyboard Shortcuts (JSON)
  3. Paste the text of keybindings.json in the opened tab (keybindings.json)

The key bindings will store in the user preference, which means you don't need set it again in the future.

Keymap source: https://github.com/Microsoft/vscode-sublime-keybindings

@ngbrown
ngbrown / BlurImg.tsx
Last active December 11, 2023 08:56 — forked from WorldMaker/use-blurhash.ts
useBlurhash hook
import React, { useState, useCallback } from "react";
import { useBlurhash } from "./use-blurhash";
import { useInView } from "react-intersection-observer";
type Props = React.DetailedHTMLProps<
React.ImgHTMLAttributes<HTMLImageElement>,
HTMLImageElement
> & { blurhash?: string | null };
// Uses browser-native `loading="lazy"` to lazy load images
@rjhansen
rjhansen / keyservers.md
Last active April 14, 2024 12:28
SKS Keyserver Network Under Attack

SKS Keyserver Network Under Attack

This work is released under a Creative Commons Attribution-NoDerivatives 4.0 International License.

Terminological Note

"OpenPGP" refers to the OpenPGP protocol, in much the same way that HTML refers to the protocol that specifies how to write a web page. "GnuPG", "SequoiaPGP", "OpenPGP.js", and others are implementations of the OpenPGP protocol in the same way that Mozilla Firefox, Google Chromium, and Microsoft Edge refer to software packages that process HTML data.

Who am I?