Skip to content

Instantly share code, notes, and snippets.

View zalito12's full-sized avatar

Gonzalo zalito12

  • Spain
View GitHub Profile
@zalito12
zalito12 / app-routing.module.ts
Last active April 19, 2024 09:58
Angular Material v17 Virtual Scroll & Scroll Restoration: How to manage custom scroll element (in my case a side nav with header) with cdk scroll
...
@NgModule({
imports: [RouterModule.forRoot(routes, { scrollPositionRestoration: 'enabled' })],
exports: [RouterModule]
})
export class AppRoutingModule {}
@zalito12
zalito12 / foo.component.html
Last active March 8, 2021 18:03
RxJS Text filter input
<input class="iconized" type="text" [ngModel]="search" (ngModelChange)="onChangeSarch($event)" />
@zalito12
zalito12 / Useful git alisases
Created November 2, 2020 10:55
This is just a note to remind my favorite git aliases when I change my environment
[alias]
co = checkout
push-origin = !git push -u origin \"$(git rev-parse --abbrev-ref HEAD)\"
@zalito12
zalito12 / Pipe.java
Created June 25, 2020 07:44
Java wrapper class to write functional code
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import javax.annotation.Nullable;
public class Pipe<E> {
@zalito12
zalito12 / custom-input.component.ts
Created January 28, 2019 11:02
Custom input component with ngModel support (Angular 6)
import { Component, forwardRef } from '@angular/core';
import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';
const noop = () => {};
export const CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR: any = {
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => ThemeCheckComponent),
multi: true
};
@zalito12
zalito12 / CooperTextView.java
Created August 15, 2017 18:12
Android Custom Font TextView
public class CooperTextView extends AppCompatTextView {
protected CooperTextView(Context context) {
super(context);
if(!isInEditMode())
this.setTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/cooper_std.ttf"));
}
public CooperTextView(Context context, AttributeSet attrs) {
super(context, attrs);
@zalito12
zalito12 / SearchBar.py
Last active January 16, 2020 17:43
Gtk Searchbar with long text field and combo box
# -*- coding: utf-8 -*-
from gi.repository import Gtk, Gdk
class Searchbar(Gtk.Revealer):
__gtype_name__ = 'Searchbar'
#Combo Ids from ui file
COMBO_ALL = 0
COMBO_TITLE = 1