Skip to content

Instantly share code, notes, and snippets.

View predorock's full-sized avatar
🎯
Focusing

Marco predorock

🎯
Focusing
View GitHub Profile
@giordanocardillo
giordanocardillo / README.md
Last active August 12, 2020 09:47
Focus Trapper - How to trap focus inside an element

FocusTrapper

A simple method to "trap" tabbing inside an element

Usage

const trapper = new FocusTrapper(element)
trapper.trap() // To trap focus
trapper.untrap() // To release
@UserGalileo
UserGalileo / universal.interceptor.ts
Last active June 15, 2022 13:34
Angular Universal - Interceptor
/**
* This interceptor ensures that the app makes requests
* with relative paths correctly server-side.
* Requests which start with a dot (ex. ./assets/...)
* or relative ones ( ex. /assets/...) will be converted
* to absolute paths
*/
import { Inject, Injectable, Injector, PLATFORM_ID } from '@angular/core';
import { isPlatformServer } from '@angular/common';
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
@sinedied
sinedied / angular.md
Last active November 8, 2023 22:53
The Missing Introduction to Angular 2 and Modern Design Patterns

Introduction to Angular

Angular (aka Angular 2) is a new framework completely rewritten from the ground up, replacing the famous AngularJS framework (aka Angular 1.x).

More that just a framework, Angular should now be considered as a whole platform which comes with a complete set of tools, like its own CLI, debug utilities or performance tools.

Getting started

@pawelgalazka
pawelgalazka / package.json
Created October 3, 2016 07:01
Example of npm scripts
"scripts": {
"clean": "rimraf dist/*",
"prebuild": "npm run clean -s",
"build": "npm run build:scripts -s && npm run build:styles -s && npm run build:markup -s",
"build:scripts": "browserify -d assets/scripts/main.js -p [minifyify --compressPath . --map main.js.map --output dist/main.js.map] | hashmark -n dist/main.js -s -l 8 -m assets.json 'dist/{name}{hash}{ext}'",
"build:styles": "stylus assets/styles/main.styl -m -o dist/ && hashmark -s -l 8 -m assets.json dist/main.css 'dist/{name}{hash}{ext}'",
"build:markup": "jade assets/markup/index.jade --obj assets.json -o dist",
"test": "karma start --singleRun",
"watch": "parallelshell 'npm run watch:test -s' 'npm run watch:build -s'",
"watch:test": "karma start",
@btroncone
btroncone / ngrxintro.md
Last active February 9, 2024 15:37
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

@renshuki
renshuki / ubuntu_agnoster_install.md
Last active May 25, 2024 06:37
Ubuntu 16.04 + Terminator + Oh My ZSH with Agnoster Theme

Install Terminator (shell)

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

Terminator should be setup as default now. Restart your terminal (shortcut: "Ctrl+Alt+T").

Install ZSH

@rauschma
rauschma / proxies-es5.js
Last active November 2, 2020 23:16
ES6 proxies in ES5
//----- The ECMAScript 6 meta object protocol (MOP) implemented in ES5
// This is how getting a property is handled internally.
// Double underscore (__) implies internal operation.
Object.prototype.__Get__ = function (propKey, receiver) {
receiver = receiver || this;
var desc = this.__GetOwnProperty__(propKey);
if (desc === undefined) {
var parent = this.__GetPrototypeOf__();
if (parent === null) return undefined;
@EddyVerbruggen
EddyVerbruggen / connectionchecker.js
Created April 11, 2014 20:33
Check for a WiFi connection in a PhoneGap app and show a message if it's not available - and stop checking
"use strict";
(function() {
var intervalID = null;
function startCheckingNetworkConnection() {
intervalID = setInterval(function() {
var networkState = navigator.connection.type;
var isWifi = networkState == Connection.WIFI;