Skip to content

Instantly share code, notes, and snippets.

View derdaani's full-sized avatar

Daniel Valenti derdaani

View GitHub Profile
@Rich-Harris
Rich-Harris / service-workers.md
Last active March 28, 2024 23:58
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

@peschee
peschee / git_ssl_self_signed.md
Last active March 7, 2024 14:20
Disable SSL verification in git repositories with self-signed certificates

Sometimes, we have to access git repositories over SSL and the server only provides a self-signed certificate 🙈. Although there are ways to increase the trust level for the self-signed certificate (https://confluence.atlassian.com/fishkb/unable-to-clone-git-repository-due-to-self-signed-certificate-376838977.html, https://confluence.atlassian.com/bitbucketserverkb/resolving-ssl-self-signed-certificate-errors-806029899.html), my recommendation is to just ignore SSL verification alltogether.

Prepend GIT_SSL_NO_VERIFY=true before every git command run to skip SSL verification. This is particularly useful if you haven't checked out the repository yet.

Run git config http.sslVerify false to disable SSL verification if you're working with a checked out repository already.

@ThomasBurleson
ThomasBurleson / tickets.facade.md
Last active February 22, 2024 07:41
Using ngrx with Effects + Facades

NgRx State Management with TicketFacade

Facades are a programming pattern in which a simpler public interface is provided to mask a composition of internal, more-complex, component usages.

When writing a lot of NgRx code - as many enterprises do - developers quickly accumulate large collections of actions and selectors classes. These classes are used to dispatch and query [respectively] the NgRx Store.

Using a Facade - to wrap and blackbox NgRx - simplifies accessing and modifying your NgRx state by masking internal all interactions with the Store, actions, reducers, selectors, and effects.

For more introduction, see Better State Management with Ngrx Facades

@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
/*
* NB: to get this working you will need to
* 1. copy a test-setup.ts file from one of the apps that uses Jest to the root of your project
* 2. replace YOUR_WORK_SPACE_NAME with the name of your work space on line 68
*/
const path = require('path');
const angularConfig = require('./angular.json');
const excludingE2E = Object.keys(angularConfig.projects)