Skip to content

Instantly share code, notes, and snippets.

@nicolae-olariu
nicolae-olariu / any.component.html
Created July 18, 2022 07:49 — forked from arniebradfo/any.component.html
Angular *ngFor recursive list tree template
<h1>Angular 2 Recursive List</h1>
<ul>
<ng-template #recursiveList let-list>
<li *ngFor="let item of list">
{{item.title}}
<ul *ngIf="item.children.length > 0">
<ng-container *ngTemplateOutlet="recursiveList; context:{ $implicit: item.children }"></ng-container>
</ul>
</li>
</ng-template>
US PHONE: ^(\\+\\d{1,2}\\s)?\\(?\\d{3}\\)?[\\s.-]?\\d{3}[\\s.-]?\\d{4}$
ZIP: ^[0-9]{5}(?:-[0-9]{4})?$
@nicolae-olariu
nicolae-olariu / ffmpeg-hls.html
Created October 2, 2021 21:05 — forked from CharlesHolbrow/ffmpeg-hls.html
Example of ffmpeg for live hls streaming with hls.js
<!DOCTYPE html>
<html lang='`en'>
<head>
<meta charset='utf-8'/>
<title>Audio only stream example</title>
<script src="//cdn.jsdelivr.net/npm/hls.js@latest"></script>
<style>
video {
width: 640px;
height: 360px;
// Run the following IIFE in the browser's console to close all GitHub conversations from a PR
(() => {
const allButtons = document.querySelectorAll('[data-disable-with="Resolving conversation…"]');
const allButtonsArray = Array.from(allButtons);
if (!allButtonsArray || !allButtonsArray.length) {
return;
}
chmod 755 $(find /path/to/base/dir -type d)
chmod 644 $(find /path/to/base/dir -type f)
@nicolae-olariu
nicolae-olariu / Observable_in_vanillaJS.md
Created October 30, 2019 09:14 — forked from ltciro/Observable_in_vanillaJS.md
simulate pattern observable in vanilla JS

Rxjs

const next = (message)=> console.log("First observer message: " + message);
const error = (error) => console.log("Second observer error: " + error);
const complete = () => console.log("complete");

const next1 = (message)=> console.log("First observer message 1: " + message);
const error1 = (error) => console.log("Second observer error 1: " + error);
const complete1 = () => console.log("complete 1");
@nicolae-olariu
nicolae-olariu / gist:8935e524752367be09d820ba5f0784eb
Created July 16, 2019 10:05
delete all files from git that were previously physically deleted
git ls-files --deleted -z | xargs -0 git rm
@nicolae-olariu
nicolae-olariu / find files by extension
Created July 16, 2019 10:04
find all html files but exclude index.html, then delete all files found
find src -name "*.html" -not -path "src/index.html" -delete
@nicolae-olariu
nicolae-olariu / git_create_orphan.sh
Created January 9, 2019 07:33 — forked from seanbuscay/git_create_orphan.sh
Create an orphan branch in a repo.
cd repository
git checkout --orphan orphan_name
git rm -rf .
rm '.gitignore'
echo "#Title of Readme" > README.md
git add README.md
git commit -a -m "Initial Commit"
git push origin orphan_name
@nicolae-olariu
nicolae-olariu / flush-dns.sh
Created January 30, 2018 10:00 — forked from craigvantonder/flush-dns.sh
Flushing the DNS in Ubuntu 16.04
#!/bin/bash
# NB: First install nscd with sudo apt-get install nscd
# run this command to flush dns cache:
sudo /etc/init.d/dns-clean restart
# or use:
sudo /etc/init.d/networking force-reload
# Flush nscd dns cache:
sudo /etc/init.d/nscd restart