Skip to content

Instantly share code, notes, and snippets.

View EliaECoyote's full-sized avatar
🌚
ㅋㅋㅋㅋ

Elia Camposilvan EliaECoyote

🌚
ㅋㅋㅋㅋ
View GitHub Profile
@DanilaMihailov
DanilaMihailov / fzf-branch-checkout.vim
Last active April 22, 2022 20:45
Select and checkout git branch using fzf in Vim
function! GitCheckoutBranch(branch)
" branch can look like this: "/remotes/origin/master [hash] info" or this: "master [hash] info"
let l:name = split(split(trim(a:branch), "", 1)[0], "/", 1)[-1]
" just show what is happening
echo "checking out ".l:name."\n"
" you can use !git, instead of Git, if you don't have Fugitive
execute "Git checkout ".l:name
endfunction
@donaldpipowitch
donaldpipowitch / use-match-media.tsx
Last active February 10, 2023 17:48
useMatchMedia - a React hook for matchMedia / media queries
import { useState, useEffect } from 'react';
// pass a query like `(min-width: 768px)`
export function useMatchMedia(query: string) {
const [matches, setMatches] = useState(() => matchMedia(query).matches);
useEffect(() => {
const mediaQueryList = matchMedia(query);
const onChange = (event: MediaQueryListEvent) => setMatches(event.matches);
@bmatcuk
bmatcuk / create-usb.sh
Created May 30, 2019 04:38
Creating a Bootable Windows USB from ISO on a Mac
# First, we need to find our device. BEFORE inserting your USB drive, run the
# following:
diskutil list
# This will output a bunch of info about all of the disk drives connected to
# your Mac. Each entry will have a header in the form "/dev/diskX", where X is
# some number starting at 0. Now, insert your USB drive and run the command
# again. You should see a new entry. Make note of the name (ie, /dev/diskX).
diskutil list
@ENAML
ENAML / CustomOps.re
Created September 29, 2018 20:14
custom operators in ReasonML
/*
See: http://2ality.com/2017/12/functions-reasonml.html#operators
*/
module MapOps {
module HashMap = Belt.HashMap.String;
let ( @@ ) = (map, key) => {
map
|> HashMap.get(_, key)
|> Belt.Option.getExn
@lilactown
lilactown / promises.re
Last active August 20, 2022 07:56
Notes on using JavaScript Promises in ReasonML/BuckleScript
/**
* Making promises
*/
let okPromise = Js.Promise.make((~resolve, ~reject as _) => [@bs] resolve("ok"));
/* Simpler promise creation for static values */
Js.Promise.resolve("easy");
Js.Promise.reject(Invalid_argument("too easy"));
@chourobin
chourobin / 0-bridging-react-native-cheatsheet.md
Last active June 28, 2024 20:49
React Native Bridging Cheatsheet
@rvl
rvl / git-pushing-multiple.rst
Created February 9, 2016 11:41
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@devongovett
devongovett / pull_request.sh
Created April 10, 2014 16:32
Bash script to make a pull request from the current git repository. Tries the upstream remote if possible, otherwise uses origin.
# put this in your .bash_profile
pull_request() {
to_branch=$1
if [ -z $to_branch ]; then
to_branch="master"
fi
# try the upstream branch if possible, otherwise origin will do
upstream=$(git config --get remote.upstream.url)
origin=$(git config --get remote.origin.url)
@Starefossen
Starefossen / vim-cheats.md
Last active July 18, 2024 16:40
My vim cheat sheet for working with tabs and window splits.

Tabs

New Tab

  • :tabnew - new blank tab
  • :tabedit [file] - open file in tab

Cursor Movement

  • gt (:tabn) - next tab