Skip to content

Instantly share code, notes, and snippets.

@rkuzsma
rkuzsma / docker-bash-completion.md
Last active November 18, 2023 09:11
How to configure Bash Completion on Mac for Docker and Docker-Compose

How to configure Bash Completion on Mac for Docker and Docker-Compose

Copied from the official Docker-for-mac documentation (thanks Brett for the updated doc pointer):

Install shell completion

Docker Desktop for Mac comes with scripts to enable completion for the docker, docker-machine, and docker-compose commands. The completion scripts may be found inside Docker.app, in the Contents/Resources/etc/ directory and can be installed both in Bash and Zsh.

Bash

Bash has built-in support for completion To activate completion for Docker commands, these files need to be copied or symlinked to your bash_completion.d/ directory. For example, if you installed bash via Homebrew:

@gunjanpatel
gunjanpatel / revert-a-commit.md
Last active May 3, 2024 20:50
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

# Bikes Factory
b1 = {brand: "scott", year: 2016, color: "red"}
b2 = {brand: "specialized", year: 2016, color: "blue"}
b3 = {brand: "Releigh", year: 2016, color: "white"}
arr = Bike.create_bikes_array([b1, b2, b3])
# arr = [< Instance of Bike 1>, <Instance of Bike 2>, <Instance of Bike 3>]
# Stretch print: ["scott", "specialized", "Releigh"]
@wesbos
wesbos / tab-trigger.js
Created November 16, 2015 19:33
How to properly get a TAB trigger working with Emmet inside of JSX
{
"keys": ["tab"],
"command": "expand_abbreviation_by_tab",
// put comma-separated syntax selectors for which
// you want to expandEmmet abbreviations into "operand" key
// instead of SCOPE_SELECTOR.
// Examples: source.js, text.html - source
"context": [
{
@danielchappell
danielchappell / route_hooks.js
Last active February 27, 2023 13:34
Ember.Route hook order
import Ember from 'ember';
// Ember 1.10
export default Ember.Route.extend({
//---fire in order on route enter---
beforeModel(transition) {
//empty by default
@suya55
suya55 / ij.sh
Last active June 21, 2017 14:28
Open a project in IntelliJ IDEA from your command line! Raw
#!/bin/sh
# check for where the latest version of IDEA is installed
IDEA=`ls -1d /Applications/IntelliJ\ * | tail -n1`
wd=`pwd`
# Setup your working directory. Edit 'work' to your working directory.
working_dir=`ls -1d ~/work/$1 | head -n1`
# were we given a directory?
if [ -d "$1" ]; then
@sgnl
sgnl / postgres-brew.md
Last active April 21, 2024 23:18
Installing Postgres via Brew (OSX) (outdated see top most note)

Outdated note: the process is a lot easier now: after you brew install postgresql you can initialize or stop the daemon with these commands: brew services start postgresql or brew services stop postgresql.

new out put may look like

To have launchd start postgresql now and restart at login:
  brew services start postgresql
Or, if you don't want/need a background service you can just run:
  pg_ctl -D /usr/local/var/postgres start
@vlandham
vlandham / part1.md
Last active March 21, 2024 12:57
Feature Branches and Pull Requests : Walkthrough

Here's a little walkthrough of how Yannick and I are using feature branches and pull requests to develop new features and adding them to the project. Below are the steps I take when working on a new feature. Hopefully this, along with watching the process on Github, will serve as a starting point to having everyone use a similar workflow.

Questions, comments, and suggestions for improvements welcome!

Start with the latest on master

When starting a new feature, I make sure to start with the latest and greatest codebase:

git checkout master
@kany
kany / sendmail_setup.md
Last active September 22, 2023 00:16
Setup SENDMAIL on Mac OSX Yosemite
@sayak-sarkar
sayak-sarkar / sublime-text-3.sh
Last active July 14, 2022 09:18
Gist to install Sublime Text 3 on RHEL 6 +
#!/bin/sh
SHORTCUT="[Desktop Entry]
Name=Sublime Text 3
Comment=Edit text files
Exec=/opt/sublime_text_3/sublime_text
Icon=/opt/sublime_text_3/Icon/128x128/sublime-text.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Utility;TextEditor;"