Skip to content

Instantly share code, notes, and snippets.

@kawazoe
kawazoe / force-reload.js
Last active February 1, 2024 06:50
Auto refresh page on manifest.json change. iOS offline PWA hack to handle auto updates.
// ------------------------------------------- IMPORTANT -------------------------------------------
// This is a development file to be minified using https://javascript-minifier.com/ and inlined in
// the index.html file. This file is not compiled or processed by webpack so it should be treated as
// low-level precompiled es5-compatible javascript. The code here is not meant to be clean, it's
// meant to be as light and fast as possible since it runs in the head tag.
// HACK: This file a hack to ensure that home-screen apps on mobile devices gets refreshed when they
// start. It works by forcing a load of the service-worker.js file and use the precache-manifest
// file name as an application version, just like a desktop browser like chrome would do. When
// when it detects a change in the application version, it reloads the page and bypass the browser's
@kawazoe
kawazoe / entities.cs
Created May 18, 2015 17:14
xprs-io - Main data structure proposition
public class User
{
public Guid Id { get; set; }
public Member Member { get; set; }
// authentication data
}
public class Member
{
@kawazoe
kawazoe / unit_testing.md
Last active August 29, 2015 14:11
Open letter to the github FurAffinity/phoenix project.

BDD / TDD - First stop for a public facing API

Based on what you have mentioned in issue #8 , I would recommend you to put more time in moving toward a TDD or BDD model.

From my own experience in writing and consuming public APIs, the first place where developers tends to look for when they need information about an API is in the documentation and the tests. Those tests are not only the best way to know what are the features and limitations of your API, they are also the best way to know how to use your API. With unit tests, you set a standard for third parties when it comes to consuming your API.

Considering the current state of your code, you should gear up toward more unit testing as soon as possible. Your current architecture, with a goal of proper testing in mind, is mediocre at best and will causes you massive headaches when you will fina