Skip to content

Instantly share code, notes, and snippets.

@btoone
btoone / curl.md
Last active December 8, 2024 05:16
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@mattratleph
mattratleph / vimdiff.md
Last active March 17, 2025 13:07 — forked from roothybrid7/vimdiff_cheet.md
vimdiff cheat sheet

vimdiff cheat sheet

##git mergetool

In the middle file (future merged file), you can navigate between conflicts with ]c and [c.

Choose which version you want to keep with :diffget //2 or :diffget //3 (the //2 and //3 are unique identifiers for the target/master copy and the merge/branch copy file names).

:diffupdate (to remove leftover spacing issues)

:only (once you’re done reviewing all conflicts, this shows only the middle/merged file)

@davisford
davisford / gist:5039064
Last active February 9, 2022 13:39
git clone into non-empty directory

Let's say you start a project locally, and do some editing.

$ mkdir -p ~/git/foo && cd ~/git/foo
$ touch NEWFILE

Now you decide you want to create a new github repo and track it, but the directory is non-empty so git won't let you clone into it. You can fix this, thusly:

@mwhite
mwhite / git-aliases.md
Last active April 19, 2025 06:26
The Ultimate Git Alias Setup

The Ultimate Git Alias Setup

If you use git on the command-line, you'll eventually find yourself wanting aliases for your most commonly-used commands. It's incredibly useful to be able to explore your repos with only a few keystrokes that eventually get hardcoded into muscle memory.

Some people don't add aliases because they don't want to have to adjust to not having them on a remote server. Personally, I find that having aliases doesn't mean I that forget the underlying commands, and aliases provide such a massive improvement to my workflow that it would be crazy not to have them.

The simplest way to add an alias for a specific git command is to use a standard bash alias.

# .bashrc
@joyrexus
joyrexus / README.md
Last active June 27, 2024 15:39
Node.js streams demystified

A quick overview of the node.js streams interface with basic examples.

This is based on @brycebaril's presentation, Node.js Streams2 Demystified

Overview

Streams are a first-class construct in Node.js for handling data.

Think of them as as lazy evaluation applied to data.

@Kartones
Kartones / postgres-cheatsheet.md
Last active April 24, 2025 10:22
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
Usage
Hello world:
$ pm2 start app.js
Raw Examples
# Fork mode
$ pm2 start app.js --name my-api # Name process
@elgalu
elgalu / waitAbsent.js
Created November 27, 2014 16:35
Actively wait for an element to disappear either by becoming invisible or by not being present. Wait up to specTimeoutMs ignoring useless webdriver errors like StaleElementError.
/**
* Actively wait for an element to disappear either by becoming
* invisible or by not being present. Wait up to specTimeoutMs
* ignoring useless webdriver errors like StaleElementError.
*
* Usage:
* Add `require('./waitAbsent.js');` in your onPrepare block or file.
*
* @example
* expect($('.some-html-class').waitAbsent()).toBeTruthy();
@Bekbolatov
Bekbolatov / tmux.md
Last active February 18, 2025 16:47
Clean tmux cheat-sheet

Clean tmux cheat-sheet

By resources

sessions

list-sessions        ls         -- List sessions managed by server
new-session          new        -- Create a new session
#!/usr/bin/env bash
#
# see: https://gist.github.com/gregorynicholas/2160046ec6946a2ce0fa
# src: https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# updated: 2015-06-06
#
# ask for the administrator password upfront
sudo -v