Skip to content

Instantly share code, notes, and snippets.

@Jeffen
Jeffen / nginx-angular-i18n.conf
Last active April 28, 2022 15:00
Angular Web App i18n Nginx Conf
map $http_accept_language $lang {
default en;
~*^fr fr;
~*^zh cn;
}
server {
# Other Configurations...
root /usr/share/nginx/i18n;
index index.html;
@peterbsmyth
peterbsmyth / recipe.example.md
Last active May 21, 2020 13:39
Making chained API Calls using @ngrx/Effects

Making chained API Calls using @ngrx/Effects

Purpose

This recipe is useful for cooking up chained API calls as a result of a single action.

Description

In the below example, a single action called POST_REPO is dispatched and it's intention is to create a new repostiory on GitHub then update the README with new data after it is created.
For this to happen there are 4 API calls necessary to the GitHub API:

  1. POST a new repostiry
  2. GET the master branch of the new repository
  3. GET the files on the master branch
@urish
urish / javascript-iot-tapas.md
Last active December 8, 2017 08:30
JavaScript IoT Tapas Resources
@poychang
poychang / .deployment
Last active August 7, 2017 03:27
[使用 Azure WebApp 的 CI/CD 佈署 Angular 應用程式] #angular #azure
[config]
command = deploy.cmd
@timbophillips
timbophillips / material.module.ts
Last active May 12, 2017 21:19
material.module.ts & theme.scss file for angular-cli to do all the material.angular.io stuff
/*
load this in the app.module.ts file with these lines:
import { MaterialModule } from './material/material.module';
imports: [
...,
...,
...,
MaterialModule
],
@esperancaJS
esperancaJS / howweuseangularcli.md
Last active August 21, 2017 11:58
Using Angular CLI in a way that scales

Angular CLI - Lessons Learned

Why Angular 2 and angular CLI ?

The one difference we can all agree on between developing in Angular or in React is the level of predictability.

Jumping from an Angular project to another should be seamless if it follows the same principles described in the style guide.

And Angular CLI helps this level of predictability even further by giving us a standard and encapsulated way of managing our environments, generating new elements and keeping up to date with the best way of doing all this.

@fredrik-lundin
fredrik-lundin / web.config
Created March 28, 2017 16:51
web.config rewrite all requests to index.html
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="redirect all requests" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />
</conditions>
<action type="Rewrite" url="index.html" appendQueryString="true" />

The Angular Service Worker

What is a service worker?

A service worker is a special script which runs in the background in the browser and manages network requests to a given origin. It's originally installed by an app and stays resident on the user's machine/device. It's activated by the browser when a page from its origin is loaded, and has the option to respond to HTTP requests during the page loading, including the initial navigation request (for /index.html). This makes service workers very useful for true offline support in applications.

Additionally, service workers are the client-side endpoint for push notifications on the web.

Features

function timeout( milliseconds: number = 0 ) {
return function( target, key, descriptor ) {
var originalMethod = descriptor.value;
descriptor.value = function (...args) {
setTimeout(() => {
originalMethod.apply(this, args);
@dshorthouse
dshorthouse / wkt.html
Last active August 29, 2019 10:32
GMap WKT Drawing
<html>
<head>
<style type="text/css">
#map{width:600px;height:400px;}
#freehand {
margin-left:-5px;
margin-top:5px;
}
#freehand .button{
direction: ltr;