Skip to content

Instantly share code, notes, and snippets.

View christo8989's full-sized avatar

Christopher Jeffery christo8989

View GitHub Profile
@christo8989
christo8989 / nuphy_air75_v2_keybindings.json
Last active March 24, 2024 23:15
NuPhy Air75 V2 Key Bindings
{
"name": "NuPhy Air75 V2",
"macros": ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
"layers": [
[
"KC_ESC",
"KC_F1",
"KC_F2",
"KC_F3",
"KC_F4",
@christo8989
christo8989 / .gitconfig
Created July 1, 2020 00:10 — forked from ddddavidmartin/.gitconfig
Git checkout alias that accepts regular expressions
[alias]
co = !"find_and_checkout_branch(){\
for last; do true; done ; \
pattern='^/.*/$' ;\
if [[ $# -eq 1 && $last =~ $pattern ]] ;\
then \
branch_pattern=`echo $last | sed -e 's/^\\///' -e 's/\\/$//'` ;\
branch=`git for-each-ref --sort=-committerdate --format='%(refname:short)' refs/heads/ | grep -E -i $branch_pattern | head -n1` ;\
if [[ $branch ]] ; then \
git checkout $branch ;\
import { OperatorFunction, SchedulerLike, concat } from "rxjs";
import { async } from "rxjs/internal/scheduler/async";
import { debounceTime, publish, take } from "rxjs/operators";
export function debounceTimeAfter<T>(
amount: number,
dueTime: number,
scheduler: SchedulerLike = async,
): OperatorFunction<T, T> {
return publish(value =>
@christo8989
christo8989 / debounce.directive.ts
Created March 20, 2020 22:08
Angular Directives
import {
Directive,
Input,
OnDestroy,
EventEmitter,
Output,
} from '@angular/core';
import { NgModel } from '@angular/forms';
import { Subscription, Observable } from 'rxjs';
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
@christo8989
christo8989 / parameter.service.ts
Created March 16, 2020 16:21
Angular ParameterService
import { Injectable } from "@angular/core"
import { ActivatedRoute, ActivatedRouteSnapshot } from "@angular/router"
@Injectable({ providedIn: "root" })
export class ParameterService {
constructor(private route: ActivatedRoute) { }
get(property: string, defaultValue: string = null): string {
const value = this.findProperty(this.route.root.snapshot, property)
@christo8989
christo8989 / .bashrc
Last active August 5, 2024 14:36
Front End (Angular) developer .bash_profile file.
# https://stackoverflow.com/a/416931
# https://askubuntu.com/a/121075
# load bash_profile from a gist
reload() {
# Windows
# $user_path="$USERPROFILE"
# curl -o "$USERPROFILE/.bashrc_gist" -H "Cache-Control: no-cache" https://gist.githubusercontent.com/christo8989/b402707a19fce6d283882f784c327254/raw/.bashrc_gist
# source "$USERPROFILE/.bashrc_gist"
# Mac / Linux?
@christo8989
christo8989 / HttpClientManager.cs
Last active February 8, 2019 23:16
HttpClients are difficult to use in C#. This class will manage them for you.
// http://www.tomdupont.net/2014/11/net-45-httpclient-is-thread-safe.html
// http://www.nimaara.com/2016/11/01/beware-of-the-net-httpclient
public static class HttpClientManager
{
private static readonly ConcurrentDictionary<string, HttpClient> clients = new ConcurrentDictionary<string, HttpClient>();
private static readonly object lockobj = new Object();
public static HttpClient Get(string url)
@christo8989
christo8989 / link.service.spec.ts
Last active May 8, 2018 16:23
This does not work with lazy loading modules (with routes) but I wanted to keep.
@christo8989
christo8989 / _svg-optimized.scss
Last active February 7, 2019 17:44
SASS mixin that optimizes the svg markup to a background style.
// Optimize svg text --> http://petercollingridge.appspot.com/svg-optimiser
// Helpfule Article --> https://css-tricks.com/using-svg
// Credit where credit is due --> https://codepen.io/jakob-e/pen/doMoML
// SVG Alignment and Aspect Ratio --> http://tutorials.jenkov.com/svg/svg-viewport-view-box.html
// Function to create an optimized svg url
// Version: 1.0.6 (plus my changes)
@mixin svg($svg){
width: 100%;
@christo8989
christo8989 / global.service.ts
Last active February 9, 2018 22:43
One way to pass objects around in an angular2 app using RxJS.
import { Injectable } from '@angular/core';
import {
Subject,
BehaviorSubject,
Subscription } from 'rxjs';
@Injectable()
export class GlobalService {
private subjects: object = {};