Skip to content

Instantly share code, notes, and snippets.

View trumbitta's full-sized avatar
🚀
Basically a rocket ship. And a bear 🐻.

William Ghelfi trumbitta

🚀
Basically a rocket ship. And a bear 🐻.
View GitHub Profile

Keybase proof

I hereby claim:

  • I am trumbitta on github.
  • I am trumbitta (https://keybase.io/trumbitta) on keybase.
  • I have a public key ASARmoiH9925VGV05nOcxWzEt_U9i84paZE99gp0Pnil3Ao

To claim this, I am signing this object:

# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
(function () {
for (const text of document.querySelectorAll("[data-testid='tweet'] div:nth-child(2) > div:nth-child(2) > div:nth-child(2) > div > span")) {
if (text.textContent) {
text.textContent = "IMHO, " + text.textContent;
}
}
})()
@trumbitta
trumbitta / with-latest-from-selector.ts
Last active June 29, 2020 22:56
Custom operator for using portions of state$ in redux-observable epics
function withLatestFromSelector<A, R, S, I>(
state$: StateObservable<A>,
selector: OutputSelector<A, R, S>,
): OperatorFunction<I, Array<I | R>> {
return (input$) =>
input$.pipe(
withLatestFrom(state$),
map(([input, state]) => [input, selector(state)]),
);
}
@trumbitta
trumbitta / trumbitta.zsh-theme
Last active November 4, 2019 13:44
My oh-my-zsh theme
# Based on https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/dpoggi.zsh-theme
# set newline variable to be used in the prompt
NEWLINE=$'\n'
if [ $UID -eq 0 ]; then NCOLOR=001; else NCOLOR=254; fi
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
PROMPT='%{$FG[$NCOLOR]%}%n%{$reset_color%}@%m\
:%~\
export class HttpErrorInterceptor implements HttpInterceptor {
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
return next.handle(request).pipe(
tap(
() => {},
error => {
// There may be other events besides the response error.
if (
error instanceof HttpErrorResponse
) {
@trumbitta
trumbitta / greeting-card.component.ts
Last active March 29, 2019 12:23
Angular for dads - Intro to components: passing data
import { Component, Input } from '@angular/core';
@Component({
selector: 'ng4d-greeting-card',
template: `
<article>
<h1>Hello, I'm {{ name }}!</h1>
<p>And I'm a {{ age }} years old dad.</p>
</article>
`,
@trumbitta
trumbitta / greeting-card.component.ts
Created March 20, 2019 18:50
Angular for dads - Intro to components 2
import { Component } from '@angular/core';
@Component({
selector: 'ng4d-greeting-card',
template: `
<article>
<h1>Hello, I'm William!</h1>
<p>And I'm a 41 years old dad.</p>
</article>
`,
@trumbitta
trumbitta / greeting-card.component.ts
Last active March 20, 2019 18:49
Angular for dads - intro to components 1
import { Component } from '@angular/core';
@Component({
selector: 'ng4d-greeting-card',
template: `
<pre>GreetingCardComponent</pre>
`,
})
export class GreetingCardComponent {}
@trumbitta
trumbitta / app.component.ts
Created March 18, 2019 13:37
Angular for dads - first steps
/** @format */
import { Component } from '@angular/core';
@Component({
selector: 'ng4d-root',
template: `
<article>
<h1>Hello, I'm William!</h1>
<p>And I'm a 41 years old dad.</p>