Skip to content

Instantly share code, notes, and snippets.

View jerkovicl's full-sized avatar

Luka Jerković jerkovicl

View GitHub Profile
@joaomoreno
joaomoreno / README.md
Last active February 1, 2024 22:19
VS Code Insiders Updater for Linux

VS Code Insiders Updater for Linux

This script will download and replace ~/Applications/VSCode-linux-x64 with the latest VS Code Insiders.

gif

Install

  1. Install jq: https://stedolan.github.io/jq/download/
  2. Place update-code somewhere in your PATH
@frenck
frenck / hassio_ubuntu_install_commands.sh
Last active February 26, 2025 21:14
Simple install command for installing Hass.io on a Generic Ubuntu/Debian machine
Unbuntu is no longer support by the Home Assistant project.
The installation commands previous listed here, are not up 2 date, not recommended, not supported and, therefore, removed.

Strings

String.prototype.*

None of the string methods modify this – they always return fresh strings.

  • charAt(pos: number): string ES1

    Returns the character at index pos, as a string (JavaScript does not have a datatype for characters). str[i] is equivalent to str.charAt(i) and more concise (caveat: may not work on old engines).

@GabeDuarteM
GabeDuarteM / Visual Studio Code.md
Last active June 10, 2019 14:02
Integrating cmder

Cmder config

Create a file named initInExternalTerminal.bat on cmder's root, containing the following:

@echo off
REM The following CMDER_ROOT must have the complete path to the cmder folder, 
REM like "C:\Users\gabriel\Documents\Cmder"
SET CMDER_ROOT=PATH/TO/THE/CMDER/FOLDER
"%CMDER_ROOT%\vendor\init.bat"
@hypery2k
hypery2k / RxJS.md
Last active October 27, 2021 13:51
Angular Code Review

Subscribing to Multiple Observables in Angular Components

Angular applications heavily rely on RxJS Observables. While building large front end apps with these technologies we quickly will need to learn how to manage subscribing to multiple Observables in our components. In this post we are going to cover five different ways to subscribe to multiple Observables and the pros and cons of each.

Observables

In our component, we will have three Observables. Each Observable has slightly different behavior. The first Observable emits a single value immediately. The second Observable emits a single value after a couple of seconds. The third Observable emits multiple values one value every second. Below are some functions that return the Observables that we will use in our components.

import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { TransferState, makeStateKey } from '@angular/platform-browser';
import { of } from 'rxjs/observable/of';
import { tap } from 'rxjs/operators';
export const POST_KEY = makeStateKey('posts');
@Injectable()
export class ApiService {
@copernicus365
copernicus365 / emoji-full-codes-csv-printout.csv
Created March 14, 2018 13:49
A comma-separated list of emoji values, containing 1) the emoji value itself (`char.ConvertFromUtf32(theDecimalNum)`), 2) its hex value representation, 3) its decimal / integer representation, and 4) the name. The code I wrote to generate this started by parsing the map contained here: https://github.com/ellekasai/twemoji-awesome/blob/gh-pages/v…
😄 1f604 128516 smile
😆 1f606 128518 laughing
😊 1f60a 128522 blush
😃 1f603 128515 smiley
263a 9786 relaxed
😏 1f60f 128527 smirk
😍 1f60d 128525 heart-eyes
😘 1f618 128536 kissing-heart
😚 1f61a 128538 kissing-closed-eyes
😳 1f633 128563 flushed
@u01jmg3
u01jmg3 / .gitconfig
Last active August 19, 2019 17:07
Sourcetree Custom Actions
[alias]
cordova = "!f(){ MESSAGE=\"Build assets for deployment\"; [ \"$(git log -1 HEAD --pretty=format:%s)\" != \"$MESSAGE\" ] && git allclean && cordova prepare --release && git add -A && git commit -m \"$MESSAGE\" && git push || echo \"Commit already present\"; }; f"
fetch-pr = "!f(){ git fetch origin refs/pull/$1/head:pr/$1; }; f"
cleanup = !git clean -df
quick-clean = !git checkout . & git cleanup
all-clean = !git reset --hard && git cleanup
swap-last = !git tag _invert && git reset --hard HEAD~2 && git cherry-pick _invert _invert~1 && git tag -d _invert
invert-index = !git commit -m tmp1 && git add -A && git commit -m tmp2 && git swap-last && git reset HEAD~1 && git reset HEAD~1 --soft
@ThomasBurleson
ThomasBurleson / untilDestroyed.ts
Last active April 18, 2023 07:47
Using untilViewDestroyed to link component ngOnDestroy to observable unsubscribe.
/**
* When manually subscribing to an observable in a view component, developers are traditionally required
* to unsubscribe during ngOnDestroy. This utility method auto-configures and manages that relationship
* by watching the DOM with a MutationObserver and internally using the takeUntil RxJS operator.
*
* Angular 7 has stricter enforcements and throws errors with monkey-patching of view component life-cycle methods.
* Here is an updated version that uses MutationObserver to accomplish the same goal.
*
* @code
*