Skip to content

Instantly share code, notes, and snippets.

@bennadel
bennadel / app.component.ts
Created February 10, 2018 14:24
Creating A Dynamic Favicon Service In Angular 5.2.4
// Import the core angular services.
import { Component } from "@angular/core";
// Import the application components and services.
import { Favicons } from "./favicons";
// ----------------------------------------------------------------------------------- //
// ----------------------------------------------------------------------------------- //
@Component({
@nathanfjohnson
nathanfjohnson / String+HTML.swift
Last active November 23, 2021 15:09 — forked from mwaterfall/StringExtensionHTML.swift
Decoding HTML Entities in Swift 4
// Swift 4
// Check out the history for contributions and acknowledgements.
extension String {
/// Returns a new string made by replacing all HTML character entity references with the corresponding character.
///
/// - Returns: decoded string
func decodingHTMLEntities() -> String {
var result = String()
var position = startIndex
@keathmilligan
keathmilligan / auth0-angular-cli-notes.md
Last active March 20, 2018 20:56
auth0 + angular-cli notes

Auth0 Example with Angular CLI

A complete example is available at https://github.com/keathmilligan/angular2-cli-auth0-example

The provided auth0 tutorial uses SystemJS, these notes outline how to integrate into an angular-cli or straight webpack project.

Create project as usual with "ng create".

Install auth0 packages & bootstrap:

@ahtcx
ahtcx / deep-merge.js
Last active April 29, 2024 17:13
Deep-Merge JavaScript objects with ES6
// ⚠ IMPORTANT: this is old and doesn't work for many different edge cases but I'll keep it as-is for any of you want it
// ⚠ IMPORTANT: you can find more robust versions in the comments or use a library implementation such as lodash's `merge`
// Merge a `source` object to a `target` recursively
const merge = (target, source) => {
// Iterate through `source` properties and if an `Object` set property to merge of `target` and `source` properties
for (const key of Object.keys(source)) {
if (source[key] instanceof Object) Object.assign(source[key], merge(target[key], source[key]))
}
@rjungemann
rjungemann / udp-thing.js
Created June 19, 2010 07:43 — forked from pquerna/udp-thing.js
UDP client and server in Node.js
log = require('sys').log
dgram = require('./lib/dgram')
var Buffer = require('buffer').Buffer;
var endat = 10;
var count = 0;
socket = dgram.createSocket();
socket.addListener('message', function (msg, rinfo) {
log('got message from '+ rinfo.address +' port: '+ rinfo.port);
log('data len: '+ rinfo.size + " data: "+ msg.toString('ascii', 0, rinfo.size));