Skip to content

Instantly share code, notes, and snippets.

View MurhafSousli's full-sized avatar

Murhaf Sousli MurhafSousli

View GitHub Profile
var __defProp=Object.defineProperty,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__publicField=(e,t,n)=>(__defNormalProp(e,"symbol"!=typeof t?t+"":t,n),n);!function(){"use strict";class e{}class t extends e{constructor(e){super(),__publicField(this,"value"),this.value=e}}class n extends e{constructor(e){super(),__publicField(this,"value"),this.value=e}}class i extends e{constructor(e){super(),__publicField(this,"value"),this.value=e}}class r extends e{constructor(e,t="unrestricted"){super(),__publicField(this,"type"),__publicField(this,"value"),this.value=e,this.type=t}}class o extends e{constructor(e){super(),__publicField(this,"value"),this.value=e}}class a extends e{}class s extends e{constructor(e){super(),__publicField(this,"value"),this.value=e}}class l extends e{}class u extends e{constructor(e){super(),__publicField(this,"value"),this.value=e}}class c extends e{constructor(e,t="integer"){super(),__publicField(this,"value"),__publicField(this
@MurhafSousli
MurhafSousli / usage-2.html
Last active December 9, 2023 07:21
Proposal: Carousel usage
<carousel [data]="items">
<carousel-thumbs></carousel-thumbs>
<div *carouselItem="let item">
<img src="item.src">
</div>
<div *carouselThumb="let item">
<img src="item.thumb">
</div>
</carousel>
@MurhafSousli
MurhafSousli / app.component.html
Created November 22, 2019 12:51
Angular Comlink
<h1>{{ textStream | async }}</h1>
<div>
<input type="text" [(ngModel)]="textInput">
<button (click)="run()">Run</button>
</div>
import { Injectable, PLATFORM_ID } from '@angular/core';
import { DOCUMENT, isPlatformBrowser } from '@angular/common';
import { BehaviorSubject, Observable, from, EMPTY } from 'rxjs';
import { catchError, tap, map, filter, take } from 'rxjs/operators';
import { ExternalLibrary, ExternalLibraryOptions, EXTERNAL_LIBRARY_OPTIONS } from './models';
// @dynamic
@Injectable({
providedIn: 'root'
npm install ngx-highlightjs
@MurhafSousli
MurhafSousli / gist-file.ts
Last active March 28, 2024 02:52
ngx-highlightjs code examples
import { HighlightPlusModule } from 'ngx-highlightjs';
@Component({
selector: 'app-root',
template: `
<pre [gist]="gistId" (gistLoaded)="gist = $event">
<code [highlight]="gist | gistContent: 'main.js'"></code>
</pre>
`,
standalone: true,
@MurhafSousli
MurhafSousli / ng-scrollbar.html
Created October 31, 2019 14:56
Test ng-scrollbar auto-height with root DOM
Remove `ngStyle` from `.ng-scrollbar-wrapper` in the template
<div class="ng-scrollbar-wrapper" [ngAttr]="state" [ngStyle]="autoHeightStyles">
To
<div class="ng-scrollbar-wrapper" [ngAttr]="state">
@MurhafSousli
MurhafSousli / hide-native-scrollbars.scss
Created July 9, 2019 22:16
Hide native scrollbars on all desktop browsers
.hide-native-scrollbar {
scrollbar-width: none; /* Firefox 64 */
-ms-overflow-style: none; /* IE 11 */
&::-webkit-scrollbar { /** Webkit */
display: none;
}
}
/**
* - Add a button that fetches data from WordPress API when clicked, "Fetch posts"
* - Get WordPress posts using the fetch API
* - Display loading icon before calling fetch
* - Display the posts in a list (display title) once the response is loaded and remove the loading icon
*/
/**
* Hints:
*
function add(a, b) {
return parseInt(a) + parseInt(b);
}
if (!process.argv[2] || !process.argv[3]) {
console.log('Insufficient number of arguments! Give two numbers please!');
}
else {
console.log('The sum of', process.argv[2], 'and', process.argv[3],
'is', add(process.argv[2], process.argv[3]));
}