Skip to content

Instantly share code, notes, and snippets.

View realtomaszkula's full-sized avatar

Tomasz Kula realtomaszkula

View GitHub Profile
@laughinghan
laughinghan / Every possible TypeScript type.md
Last active June 19, 2024 10:18
Diagram of every possible TypeScript type

Hasse diagram of every possible TypeScript type

  • any: magic, ill-behaved type that acts like a combination of never (the proper [bottom type]) and unknown (the proper [top type])
    • Anything except never is assignable to any, and any is assignable to anything at all.
    • Identities: any & AnyTypeExpression = any, any | AnyTypeExpression = any
    • Key TypeScript feature that allows for [gradual typing].
  • unknown: proper, well-behaved [top type]
    • Anything at all is assignable to unknown. unknown is only assignable to itself (unknown) and any.
    • Identities: unknown & AnyTypeExpression = AnyTypeExpression, unknown | AnyTypeExpression = unknown
  • Prefer over any whenever possible. Anywhere in well-typed code you're tempted to use any, you probably want unknown.
@kapunahelewong
kapunahelewong / angular-docs.md
Last active July 20, 2021 15:52
Contributing to the Angular docs

Make sure you've read the Angular.io CONTRIBUTING.md before starting out.

Angular.io local setup

Follow these steps when you are setting up the repo locally for the first time and would like to view your changes in the browser as you edit.

  1. Fork angular/angular.

In terminal:

@mhevery
mhevery / microsyntax.md
Last active November 21, 2022 09:53
Angular microsyntax gramar

Microsyntax

Microsyntax in Angular allows you to write <div *ngFor="let item of items">{{item}}</div> instead of <ng-template ngFor [ngForOf]="items"><div>{{item}}</div></ng-template.

Constraints

The microsyntax must:

  • be know ahead of time so that IDEs can parse it without knowing what is the underlying semantics of the directive or what directives are present.
  • must translate to key-value attributes in the DOM.
@glenngr
glenngr / example-usage.ts
Last active December 17, 2018 23:50
Fit contents directive for angular2-google-maps (sebm-google-map)
import { Subject } from 'rxjs/Subject';
import { Store } from '@ngrx/store';
import { Component, OnInit, OnDestroy, AfterViewInit } from '@angular/core';
import { AppState } from '../../../root.reducer';
@Component({
selector: 'my-map-example',
template: `
<sebm-google-map
@giovannicandido
giovannicandido / rename_pascal_columns.sql
Created June 12, 2016 02:28
Rename pascal column names to snake case columns names in postgresql
SELECT ddlsql || regexp_replace(name, E'^_',E'','g') || ';' as ddlsql FROM
(
SELECT 'ALTER TABLE ' || quote_ident(c.table_schema) || '.'
|| quote_ident(c.table_name) || ' RENAME "' || c.column_name || '" TO ' As ddlsql, quote_ident(lower(regexp_replace(column_name, E'([A-Z])', E'\_\\1','g'))) as name
FROM information_schema.columns As c
WHERE c.table_schema NOT IN('information_schema', 'pg_catalog')
AND c.column_name <> lower(c.column_name)
ORDER BY c.table_schema, c.table_name, c.column_name
) x;
@giovannicandido
giovannicandido / rename_pascal_tablenames.sql
Last active June 7, 2017 09:07
Rename pascal case tables to snake case in postgresql
SELECT ddlsql || regexp_replace(name, E'^_',E'','g') As ddlsql FROM (SELECT 'ALTER TABLE ' || quote_ident(t.table_schema) || '.'
|| quote_ident(t.table_name) || ' RENAME TO ' As ddlsql, quote_ident(lower(regexp_replace(t.table_name, E'([A-Z])', E'\_\\1','g'))) || ';' as name
FROM information_schema.tables As t
WHERE t.table_schema NOT IN('information_schema', 'pg_catalog')
AND t.table_name <> lower(t.table_name)
ORDER BY t.table_schema, t.table_name) x;
@btroncone
btroncone / ngrxintro.md
Last active June 26, 2024 08:27
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

@mauvm
mauvm / Jasmine-and-Babel6.md
Created November 12, 2015 10:51
Jasmine ES6 run script for use with Babel 6
$ npm install --save babel-cli babel-preset-es2015
$ npm install --save-dev jasmine

.babelrc:

{
 "presets": ["es2015"]