Skip to content

Instantly share code, notes, and snippets.

@kentcdodds
kentcdodds / session.server.ts
Created November 18, 2021 21:04
Authentication in Remix applications
import * as bcrypt from "bcrypt";
import { createCookieSessionStorage, redirect } from "remix";
import { db } from "./db.server";
export type LoginForm = {
username: string;
password: string;
};
@strix
strix / git-fuzzy-searchers.sh
Created September 16, 2020 20:59
Better git log and git stash fuzzy searching
# Based off examples from https://gist.github.com/junegunn/f4fca918e937e6bf5bad
# git log show with fzf
gli () {
# param validation
if [[ ! `git log -n 1 $@ | head -n 1` ]] ;then
return
fi
@schmidsi
schmidsi / ScrollPositionProvider.tsx
Last active March 10, 2021 09:03
Scribble to fix scroll position
import React, { useEffect, useContext } from 'react';
import Router from 'next/router';
export const ScrollPositionContext = React.createContext({
triggerScroll: () => null,
});
export const useScrollPosition = () => useContext(ScrollPositionContext);
let routerBound = false;
# this file contains keys needed for decryption of file system data (WUD/WUX)
# 1 key per line, any text after a '#' character is considered a comment
# the emulator will automatically pick the right key
541b9889519b27d363cd21604b97c67a # example key (can be deleted)
d7b00402659ba2abd2cb0db27fa2b656 # Common
805e6285cd487de0faffaa65a6985e17 # Espresso Ancast
b5d8ab06ed7f6cfc529f2ce1b4ea32fd # Starbuck Ancast
9a164ee15ac7ceb64d3cc130094095f6 # 007 Legends [EUR, NUS]
@liamdawson
liamdawson / com.ldaws.CapslockEsc.plist
Last active April 9, 2023 07:34
Caps Lock -> Esc on macos
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- Place in ~/Library/LaunchAgents/ -->
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.ldaws.CapslockEsc</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/hidutil</string>
import React from "react";
import { Location } from "@reach/router";
let scrollPositions = {};
class ManageScrollImpl extends React.Component {
componentDidMount() {
try {
// session storage will throw for a few reasons
// - user settings
@itod
itod / split_keyboards.md
Last active April 28, 2024 19:44
Every "split" mechanical keyboard currently being sold that I know of
@wojteklu
wojteklu / clean_code.md
Last active May 2, 2024 23:25
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@thevangelist
thevangelist / convert-to-kebab-case.js
Created September 21, 2016 10:11
JS: convert to kebab-case
const convertToKebabCase = (string) => {
return string.replace(/\s+/g, '-').toLowerCase();
}
@lukasborawski
lukasborawski / input.scss
Last active February 12, 2021 11:12
Perfect media-queries screen breakpoints SASS @mixin. Tested on Apple Devices: iPhone4, iPhone5, iPad3, MacBook Pro, iPad Mini. http://sassmeister.com/gist/8529371
$media-queries: true;
@mixin bp($point) {
@if ($media-queries) {
$bp-large-screen: 1824px;
$bp-bigscreen: 1824px;
$bp-ipad-max: 1024px;
$bp-ipad-min: 768px;
$bp-iphone5-max: 568px;
$bp-iphone-max: 480px;