Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
👨🏻‍🍳 helping you cook better apps

Younes Jaaidi yjaaidi

💭
👨🏻‍🍳 helping you cook better apps
View GitHub Profile
@yjaaidi
yjaaidi / prototype-pollution.js
Created Oct 2, 2019
Prototype pollution example
View prototype-pollution.js
const u1 = {firstName: 'Foo'}
const u2 = {firstName: 'John'}
const body = JSON.parse('{"__proto__": {"admin": true}}')
function vulnerableExtend(dst, src) {
Object.entries(src)
.forEach(([k, v]) => {
if (k in dst) {
vulnerableExtend(dst[k], src[k]);
View views-sandwich-sandwich-views.module.ts
@NgModule({
imports: [
RoutingModule.forChild([
{
path: 'catalog',
# Or, you can lazy load catalog if you wish.
component: SandwichCatalogViewComponent
}
]),
SandwichCatalogViewModule
View views-app-routing.module.ts
@NgModule({
imports: [
RoutingModule.forRoot([
{
path: 'sandwich',
loadChildren: './sandwich/sandwich-views.module#SandwichViewsModule'
}
])
]
})
View ng-vdom-example.ts
@Component({
template: ``
})
export class AppComponent extends Renderable {
render() {
return (
<h1>Hello World!</h1>
)
}
}
View angular-tagged-template.ts
/**
* @todo when `deps` will be added to `Component` definition,
* we could return `{deps, template}` then use it like this:
* ```
* @Component({
* selector: 'wt-root',
* ...ngTemplate`<${Child}></${Child}>`
* })
* ```
@yjaaidi
yjaaidi / +title-v1.module.ts
Last active Jun 7, 2019
Reactive Component Loader Demo
View +title-v1.module.ts
@Component({
selector: 'wt-title-v1',
template: `<h1>v1: {{ title }}</h1>`
})
export class TitleV1Component {
@Input() title: string;
}
@NgModule({
imports: [CommonModule],
@yjaaidi
yjaaidi / speech-recognition-playground.js
Last active Oct 11, 2018
Speech Recognition Playground
View speech-recognition-playground.js
recognition = new webkitSpeechRecognition();
recognition.continuous = true;
recognition.lang = 'fr-FR';
recognition.onresult = console.log;
recognition.start();
View angular-logo-selector.ts
@Component({
selector: 'wt-logo',
template: `
<img [src]="getLogoUrl()">
<button (click)="company = 'wishtack'">WISHTACK</button>
<button (click)="company = 'google'">GOOGLE</button>
`
})
export class LogoComponent {
View angular-picture-require.ts
@Component({
selector: 'wt-logo',
template: `<img [src]="logoUrl">`
})
export LogoComponent {
logoUrl = require('!!url-loader!./logo.svg');
}
View angular-rx-scavenger-collect-by-key.ts
import { Component, OnInit } from '@angular/core';
import { Scavenger } from '@wishtack/rx-scavenger';
import { interval } from 'rxjs';
@Component({
template: `<div>{{ count }}</div>`
})
export class CounterComponent implements OnDestroy, OnInit {
count: number;
You can’t perform that action at this time.