Skip to content

Instantly share code, notes, and snippets.

View janosorcsik's full-sized avatar

János Orcsik janosorcsik

View GitHub Profile
import * as React from "react";
import { useMousePosition } from "~/hooks/useMousePosition";
/** Component to cover the area between the mouse cursor and the sub-menu, to allow moving cursor to lower parts of sub-menu without the sub-menu disappearing. */
export function MouseSafeArea(props: { parentRef: React.RefObject<HTMLDivElement> }) {
const { x = 0, y = 0, height: h = 0, width: w = 0 } = props.parentRef.current?.getBoundingClientRect() || {};
const [mouseX, mouseY] = useMousePosition();
const positions = { x, y, h, w, mouseX, mouseY };
return (
<div
@evici
evici / default-finder-view
Created January 16, 2020 18:28
Set Default Finder View and Arrange By Options
1. Backup com.apple.finder.plist
cp ~/Library/Preferences/com.apple.finder.plist ~/Desktop
2. Set top-level defaults using the defaults command
Default to list view:
defaults write com.apple.finder FXPreferredViewStyle Nlsv
Default Arrange By flags that don't seem to be effective:
defaults write com.apple.finder FXArrangeGroupViewBy kind
defaults write com.apple.finder FXPreferredGroupBy kind
@romkatv
romkatv / Pure style for Powerlevel10k.md
Last active May 4, 2024 16:34
Pure style for Powerlevel10k

Powerlevel10k can generate the same prompt as Pure.

pure

Installation

git clone https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>! ~/.zshrc
@robvolk
robvolk / .bash_profile.sh
Created August 21, 2018 16:58
Cleanup git branches
gitc() {
git fetch --prune
for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`;
do
git branch -D $branch
done;
git branch --merged master | grep -v '^*' | grep -v '^ master$' | xargs git branch -d
}
@ryanml
ryanml / stranger-things.bas
Last active May 13, 2018 02:48
Bob's Password Brute-Forcer from Stranger Things Season 2
10 DIM FourDigitPassword INTEGER
20 FOR i = 0 TO 9
30 FOR j = 0 TO 9
40 FOR k = 0 TO 9
50 FOR l = 0 TO 9
60 FourDigitPassword = getFourDigits (i,j,k,l)
70 IF checkPasswordMatch(FourDigitPassword) = TRUE THEN
80 GOTO 140
90 END
100 NEXT l
@swyxio
swyxio / flexbox-cheat-sheet.md
Last active January 19, 2023 07:35
cheat sheet from flexbox.io

Demo

How to install

  1. Get fzf
  2. Install all-the-package-names globally: npm i -g all-the-package-names
  3. Add the following alias to your .bashrc: alias npmi = 'all-the-package-names | fzf | xargs npm install'

How to use

Just use npmi instead of npm i <package-name>. All options work (--save, -g etc).

@Tyrael
Tyrael / active.md
Last active November 10, 2021 08:53
active github users from Hungary

Most active GitHub users from Hungary

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Sun, 30 Aug 2015 10:08:52 GMT till Tue, 30 Aug 2016 10:08:52 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user =&gt; user.followers &gt; 1)
# Add the remote, call it "upstream":
git remote add upstream https://github.com/whoever/whatever.git
# Fetch all the branches of that remote into remote-tracking branches,
# such as upstream/master:
git fetch upstream
# Make sure that you're on your master branch:
@parmentf
parmentf / GitCommitEmoji.md
Last active May 9, 2024 13:47
Git Commit message Emoji