Skip to content

Instantly share code, notes, and snippets.

@Wildhammer
Wildhammer / example-tel-input-example.html
Last active June 12, 2020 20:39
Passing in the arguments to _handleInput
<div [formGroup]="parts" ...>
<input ... formControlName="area"
(input)="_handleInput(parts.controls.area,exchange)" #area>
...
<input ... formControlName="exchange"
(input)="_handleInput(parts.controls.exchange,subscriber)" #exchange>
...
<input ... formControlName="subscriber"
(input)="_handleInput(parts.controls.subscriber,subscriber)" #subscriber>
</div>
_handleInput(control: FormControl, nextElement: HTMLInputElement): void {
this.autoFocusNext(control, nextElement);
this.onChange(this.value);
}
autoFocusNext(control: AbstractControl, nextElement: HTMLInputElement | null): void {
if (!control.errors && !!nextElement) this._focusMonitor.focusVia(nextElement, "program");
}
<mat-icon svgIcon="icon-pen"></mat-icon>
@NgModule({
imports: [
...
MatIconModule
],
declarations: [ ... ],
exports: [
...
MatIconModule
],
// importing the entry point of library
@import "~@wildhammer/common/scss/styles";
...
"cp-styles": "cpx-fixed \"./projects/common/src/**/*.scss\" \"./dist/common/scss/\"",
"cp-assets": "cpx-fixed \"./projects/common/src/assets/**/*\" \"./dist/common/assets/\"",
"cp-readme": "cpx-fixed \"./README.md\" \"./dist/common/\"",
"cp-npmrc": "cp ./.npmrc ./dist/common/",
"postbuild": "npm run cp-styles && npm run cp-assets",
"postpack": "npm run cp-npmrc && npm run cp-readme",
"npm-pack": "cd dist/common && npm pack",
"package": "ng build common --prod && npm run postbuild && npm run npm-pack && npm run postpack",
"release": "npm run package && cd ./dist/common && npm publish"
/* This is to be imported in the consumer project */
@import "~bootstrap/scss/functions";
@import "~bootstrap/scss/variables";
@import "variables";
@import "~bootstrap/scss/bootstrap";
// everything till here is for overriding bootstrap breakpoints
@import "common";
/* Things like typograpohy, theming usually follow up
in a shared library like this
@import "~bootstrap/scss/mixins/_breakpoints.scss";
@import "variables";
/* This will generate bootstrap style responsive classes for flex-basis
e.g. flex-basis-md-25*/
@each $breakpoint, $value in $breakpoints {
$min: breakpoint-min($breakpoint);
$breakpoint-name: if($min, -#{$breakpoint}, "");
@for $i from 1 through 4 {
@include media-breakpoint-up($breakpoint) {
/* I use bootstrap in my project but
I'd like to override the breakpoint values */
$grid-breakpoints: (
xs: 0,
sm: 600px,
md: 960px,
lg: 1280px,
xl: 1920px,
);
@Wildhammer
Wildhammer / hash.c
Last active February 13, 2016 06:53 — forked from tonious/hash.c
A quick hashtable implementation in c.
#define _XOPEN_SOURCE 500 /* Enable certain library functions (strdup) on linux. See feature_test_macros(7) */
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <string.h>
#define INITIAL_HASH_SIZE 4
#define MAX_LOAD_FACTOR 2
#define SCALE_FACTOR 2