Skip to content

Instantly share code, notes, and snippets.

View Robert-96's full-sized avatar
🔧
Working on @altwalker

Dezmerean Robert Robert-96

🔧
Working on @altwalker
View GitHub Profile
@Robert-96
Robert-96 / cli.py
Last active January 17, 2020 13:05
Click version option with `--version` and `-v`
import click
# the version number to show. If None Click attempts an auto discovery via setuptools.
VERSION = "0.1"
@click.group()
@click.version_option(VERSION, "-v", "--version")
def cli():
pass
@Robert-96
Robert-96 / cli.py
Created February 26, 2019 10:53
Click help option with `--help` and `-h`
import click
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
@click.group(context_settings=CONTEXT_SETTINGS)
def cli():
pass
@Robert-96
Robert-96 / README.md
Last active December 26, 2020 01:15
Docker Cheat Sheet

Docker Cheat Sheet

TL;DR

$ docker build -t my-image .                           # Create image using this directory's Dockerfile

$ docker run -p 4200:80 my-image                       # Run "my-image" mapping port 4200 to 80
$ docker run -d -p 4200:80 my-image                    # Same thing, but in detached mode
$ docker run username/repository:tag                   # Run image from a registry
@Robert-96
Robert-96 / README.md
Last active November 28, 2020 17:00
WIP: grep Cheat Sheet

grep Cheat Sheet

grep prints lines that match a pattern, the name comes from the phrase "global regular expression print".

@Robert-96
Robert-96 / README.md
Last active September 19, 2020 10:09
WIP: cURL Cheat Sheet

cURL Cheat Sheet

TL;DR

$ curl www.example.com

Table of contents

@Robert-96
Robert-96 / README.md
Last active July 5, 2020 21:59
Python3 CLI Tools

Python3 CLI Tools

TL;DR

$ python -m http.server                           # Create a webserver serving files relative to the current directory
$ python -m http.server 8080                      # Start the webserver on port 8080
$ python -m http.server -b 127.0.0.1              # Bind the webserver to 127.0.0.1    
$ python -m http.server -d path/to/files          # Serve files relative to path/to/files  
@Robert-96
Robert-96 / README.md
Last active May 4, 2024 06:05
Ember.Js: Installing Tailwind CSS

Ember.Js: Installing Tailwind CSS

TL;DR

$ ember install ember-cli-postcss                   # Install ember-cli-postcss
$ npm install --save-dev tailwindcss                # Install tailwindcss

$ npx tailwind init app/styles/tailwind.config.js   # Optional: Generate a Tailwind config file for your project  
$ npm install -save-dev postcss-import # Optional: If you want to use the @import statement
@Robert-96
Robert-96 / README.md
Last active July 22, 2020 18:55
Ember.Js: Build a Markdown component with ShowdownJs

Ember.Js: Build a Markdown component with ShowdownJs

With the help of ShowdownJs and HighlightJs you can build an Markdown component with syntax highlighting.

ShowdownJs is an easy to use Markdown to HTML converter, it can be used in both client side (browser) or server side (with nodejs).

HighlightJs is an JavaScript library for syntax highlighting on the web. It supports 189 languages and 94 styles.

@Robert-96
Robert-96 / README.md
Last active April 2, 2023 16:50
Github Markdown Cheat Sheet
@Robert-96
Robert-96 / README.md
Last active February 13, 2024 15:24
Get URL Parameters with JavaScript

Get URL Parameters with JavaScript

URL Parameters (Query Parameters) are a set o key value pars attached to the end of a url. They are used to send small amounts of data from page to page, or from client to server via a URL.

TL;DR

const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);