Open in app

Sign In

Write

Sign In

Ole Ersoy
Ole Ersoy

311 Followers

Home

About

7 hours ago

Adding Global SASS Styles for Storybook to an Angular Project

Scenario We want all our stories to have access to the styles in the Angular styles.scss stylesheet. Approach Load styles.scss in the Storybook ./storybook/preview.js configuration file. import '!style-loader!css-loader!sass-loader!../src/styles.scss';

UX

1 min read

Adding Global SASS Styles for Storybook to an Angular Project
Adding Global SASS Styles for Storybook to an Angular Project
UX

1 min read


Feb 28

Working in a Zen Garden

We tend to regard ourselves as puppets of the Past, driven along by something that is always behind us. — Alan Watts Do you ever “Feel” the temptation while working, even though you love what you do, to perhaps check the news, social media, etc. There’s this “Freedom” in just…

Education

2 min read

Working in a Zen Garden
Working in a Zen Garden
Education

2 min read


Feb 25

Passing JSON Configuration Objects to Angular Directive Input Properties

Scenario Our directive ElColorDirectivehas a config custom Angular @Input property that we need to set using a configuration object. The directive targets elements defined with the config property like this. button[config] Since the selector includes [config] we cannot pass the configuration object in like this. <button [config]="{ color: 'yellow' }">hello</button> Putting brackets around config ( [config] ) means that config will no longer be in the DOM and therefore not matched by the button[config] selector.

UX

1 min read

Passing JSON Configuration Objects to Angular Directive Input Properties
Passing JSON Configuration Objects to Angular Directive Input Properties
UX

1 min read


Feb 23

Sharing a Google Fonts Material Icons Query

Scenario We wish send someone a link to Google Font Volume Material Icons. Approach Set query to volume in the Material Icons font URL. https://fonts.google.com/icons?icon.query=volume Demo Material Symbols and Icons - Google Fonts Material Symbols are our newest icons consolidating over 2,500 glyphs in a single font file with a wide range of design…fonts.google.com

UX

1 min read

Sharing a Google Fonts Material Icons Query
Sharing a Google Fonts Material Icons Query
UX

1 min read


Feb 10

Performing Stackblitz Unit Testing with Power Assert as a Minimal Testing Framework

Scenario We have created a function that returns a quadrant given a center and x and y coordinates. We want to unit test it in Stackblitz using Node’s assert function as a minimal testing framework. function quadrant(MC: MetaCoordinates): Quadrant { if (MC.x <= MC.c.x) { if (MC.y…

Programming

2 min read

Performing Stackblitz Unit Testing with Power Assert as a Minimal Testing Framework
Performing Stackblitz Unit Testing with Power Assert as a Minimal Testing Framework
Programming

2 min read


Feb 10

Restricting a Typescript Type to a Set of Numbers

Scenario We need a Typescript type that restricts a Quadrant to the numbers 1,2,3,4. Approach type Quadrant = 1 | 2 | 3 | 4; Demo

Web Development

1 min read

Restricting a Typescript Type to a Set of Numbers
Restricting a Typescript Type to a Set of Numbers
Web Development

1 min read


Feb 4

Creating a Celcius Display in HTML

Scenario We want the degree symbol not included in the characters of the Celcius rendering such that the text can be centered vertically within our Flexbox.

Programming

1 min read

Creating a Celcius Display in HTML
Creating a Celcius Display in HTML
Programming

1 min read


Feb 2

Converting Angular Inputs to Boolean Values

Scenario We are creating a power button component which is off by default. We want the declaration to support switching it on by simply adding on as an attribute to the component declaration like this. <power-button on></power-button> Approach Create a toBoolean utility function to convert the @Input on property. /** * If…

Programming

2 min read

Converting Angular Inputs to Boolean Values
Converting Angular Inputs to Boolean Values
Programming

2 min read


Jan 25

Left Aligning the Text Within an Angular Material Button

Scenario We have an Angular Material raised button and we want the within it to be left aligned rather than centered. Approach Since Angular Materials buttons use a flex layout, we need to add the justify-content: flex-start; style. [mat-raised-button] { justify-content: flex-start; } Demo

UX

1 min read

Left Aligning the Text Within an Angular Material Button
Left Aligning the Text Within an Angular Material Button
UX

1 min read


Jan 18

Profiling Javascript Performance with the Console

Scenario We want to see how many milliseconds it takes to mutate a count index reference from one to a million. Approach Use console.time . console.time('count performance'); for (let count = 0; count++; count <= 1000000) { //Profile how long this takes } console.timeEnd('count performance'); This will log. count performance: 0.005126953125 ms Demo Note that the Stackblitz console on the right hand side currently does not show console.time , so to see the result open the Developer Tools in your browser and click on the console.

JavaScript

1 min read

Profiling Javascript Performance with the Console
Profiling Javascript Performance with the Console
JavaScript

1 min read

Ole Ersoy

Ole Ersoy

311 Followers

Founder of Firefly Semantics Corporation

Following
  • Farhan Tanvir

    Farhan Tanvir

  • Sebastian

    Sebastian

  • Matt Lillywhite

    Matt Lillywhite

  • Dr Mehmet Yildiz

    Dr Mehmet Yildiz

  • Natesky

    Natesky

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Text to speech