Skip to content

Instantly share code, notes, and snippets.

View tangoabcdelta's full-sized avatar

tangoabcdelta

View GitHub Profile
@tangoabcdelta
tangoabcdelta / set.upstream.to.md
Created February 2, 2021 04:22
set upstream to

Set Upstream branch for a git branch

git branch --set-upstream-to=origin/feat-foobar

@tangoabcdelta
tangoabcdelta / my.sublime.settings.json
Created February 1, 2021 22:53
my sublime settings
{
"always_show_minimap_viewport": true,
"block_caret": true,
"color_scheme": "Packages/Color Scheme - Default/Mariana.sublime-color-scheme",
"detect_indentation": true,
"draw_white_space": "all",
"font_size": 11,
"hot_exit": true,
"ignored_packages": ["Vintage"],
"theme": "Default.sublime-theme",
@tangoabcdelta
tangoabcdelta / semver.md
Last active January 30, 2021 14:31
semver for alpha and beta releases

MAJOR.MINOR.PATCH, increment the:

  • MAJOR version when you make incompatible API changes,
  • MINOR version when you add functionality in a backwards compatible manner, and
  • PATCH version when you make backwards compatible bug fixes.
  • Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.

H1

0.1.0
@tangoabcdelta
tangoabcdelta / string.match.md
Last active January 27, 2021 08:21
How to check if a string contains another substring in JavaScript?

All possibilities

new RegExp('word')).test(str) // ES2
str.indexOf('word') !== -1 // ES2
str.includes('word') // ES6
str.match(/word/gi)?.length > 0 //ES2019
@tangoabcdelta
tangoabcdelta / shortcuts.md
Last active January 21, 2021 11:15
Visual Studio Code or vscode default keyboard shortcuts (only the ones that matter)

Table:

Purpose Command Remark
Move line up/down Alt + Up Arrow/Down Arrow If you're from a sublime background like me, this is the equivalent for ctrl + shift in Sublime.
Jump to matching bracket Ctrl+Shift+\ Chrome's ctrl + m equivalent or Sublime's ctrl + <bracket>
Indent/outdent line Ctrl + ] or [ --
Duplicate line Going to the end of the line and then doing Ctrl + C followed by Ctrl + V This is Sublime or Atom's Ctrl + D equivalent
@tangoabcdelta
tangoabcdelta / canvas.script.md
Created January 21, 2021 01:40
HTML5 Canvas quick commands to export the contents to an image (as Data URI)
export the contents of a canvas as an image
img.src = document.getElementById('canvas').toDataURL();
// src will look like data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNb...
bonus: export by specifying the quality
canvas.toDataURL('image/jpeg', 1.0); // full
canvas.toDataURL('image/jpeg', 0.5); // medium

canvas.toDataURL('image/jpeg', 0.1); // low

@tangoabcdelta
tangoabcdelta / how.to.exit.vim.md
Created January 20, 2021 23:08
How to exit vim:

Remember this as a mantra: "Escape, Colon, Doublewww, Queue", Esc + : + w + q

@tangoabcdelta
tangoabcdelta / start.stop.apache2.instructions.md
Created January 20, 2021 21:14
How to kill apache2 service running on port 80 and how to stop apache2 from launching at start up - Linux and Mac

How to stop apache2 from autostarting during start up

How to stop apache2 from autostarting during start up - Linux
  • start - sudo service apache2 start
  • stop - sudo service apache2 stop
  • restart - sudo service apache2 restart
  • enable auto launch - sudo systemctl enable apache2
  • disable apache2 auto launch - sudo systemctl disable apache2
@tangoabcdelta
tangoabcdelta / start.stop.postgres.instructions.md
Created January 20, 2021 21:09
How to stop PostgreSQL / postgres from auto-starting during start up - Linux and Mac (how do you remove them from startup)
How to stop PostgreSQL / postgres from autostarting during start up - Linux

(works on ubuntu 16.04 or later which use systemd)

  • start - sudo service postgresql start
  • stop - sudo service postgresql stop
  • restart - sudo service postgresql restart
  • auto launch - sudo systemctl enable postgresql
  • disable auto launch - sudo systemctl disable postgresql