Skip to content

Instantly share code, notes, and snippets.

View xiaohutai's full-sized avatar

Xiao-Hu Tai xiaohutai

  • The Netherlands
View GitHub Profile

Everything I Know About UI Routing

Definitions

  1. Location - The location of the application. Usually just a URL, but the location can contain multiple pieces of information that can be used by an app
    1. pathname - The "file/directory" portion of the URL, like invoices/123
    2. search - The stuff after ? in a URL like /assignments?showGrades=1.
    3. query - A parsed version of search, usually an object but not a standard browser feature.
    4. hash - The # portion of the URL. This is not available to servers in request.url so its client only. By default it means which part of the page the user should be scrolled to, but developers use it for various things.
    5. state - Object associated with a location. Think of it like a hidden URL query. It's state you want to keep with a specific location, but you don't want it to be visible in the URL.
@amcgregor
amcgregor / 404.html
Last active October 5, 2025 01:37
My own HTML5 boilerplate sans most of the code. Because there's too much Romulus-be-damned boilerplate, and people fail to realize almost none of it is in any way needed. For more details than you probably wanted, ref: https://codepen.io/tomhodgins/post/code-that-you-just-never-ever-need-to-write formerly https://tomhodgins.hashnode.dev/code-tha…
<!DOCTYPE html><html lang=en>
<title>Page Not Found</title>
<meta charset=utf-8>
<meta name=viewport content="width=device-width,initial-scale=1">
<h1>Page Not Found</h1>
<p>Sorry, but the page you were trying to view does not exist.</p>
@philhawksworth
philhawksworth / jamstack-q-and-a-frontend-united.md
Last active May 23, 2019 12:50
Q&A from the JAMstack talk at Frontend United

Thanks for all of your questions during my talk at Frontend United: JAMstack: Silly name. Serious business.

1. Jeremy asks:

@ankedsgn
ankedsgn / master_with_404_title.twig
Created January 11, 2019 11:16
Return a title in the Bolt 404 page with SEO extension
{% if app.request.get('_route') %}{# no route, no SEO tags #}
<title>{{ seo.title() }}</title>
{{ seo.metatags() }}
{% else %}
<title>Niet Gevonden | {{ config.get('general/sitename') }}</title>
{% endif %}
@DavidKuennen
DavidKuennen / minimal-analytics-snippet.js
Last active November 9, 2025 07:22
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@ankedsgn
ankedsgn / contenttypes.yml
Created November 30, 2018 10:24
Check in contenttypes.yml met regex op valide URL
website:
type: text
label: Website sponsor
postfix: 'formaat: http://www.sponsor.nl'
pattern: "^http(s?):\/\/.*" # see: http://html5pattern.com/
error: "Vul een url in inclusief 'http://' of 'https://'"
@dominictarr
dominictarr / readme.md
Created November 26, 2018 22:39
statement on event-stream compromise

Hey everyone - this is not just a one off thing, there are likely to be many other modules in your dependency trees that are now a burden to their authors. I didn't create this code for altruistic motivations, I created it for fun. I was learning, and learning is fun. I gave it away because it was easy to do so, and because sharing helps learning too. I think most of the small modules on npm were created for reasons like this. However, that was a long time ago. I've since moved on from this module and moved on from that thing too and in the process of moving on from that as well. I've written way better modules than this, the internet just hasn't fully caught up.

@broros

otherwise why would he hand over a popular package to a stranger?

If it's not fun anymore, you get literally nothing from maintaining a popular package.

One time, I was working as a dishwasher in a restu

Ik schrijf u in uw hoedanigheid als gegevensbeschermingsfunctionaris voor uw bedrijf.
Door een situatie waarin uw bedrijf mij zonder expliciete toestemming heeft aangemeld voor solliciaties bij bedrijven die geen relevantie houden tot mijn profiel heb ik zorgen over de verwerking van data binnen uw bedrijf.
Ik zou graag willen dat u van meet af aan weet dat ik binnen een maand antwoord verwacht op mijn verzoek, zoals vereist krachtens artikel 12, bij gebreke waarvan ik mijn verzoek zal doorzenden met een klachtbrief aan de bevoegde autoriteiten.
Gelieve het volgende te adviseren:
1. Bevestig mij of mijn persoonlijke gegevens worden verwerkt. Als dit het geval is, geef me dan de categorieën persoonlijke gegevens die u over mij hebt in uw bestanden en databases.
Value Longhand Summary
initial 0 1 auto cannot grow but can shrink when there isn't enough space
auto 1 1 auto can grow and shrink to fit available space
none 0 0 auto cannot grow or shrink AKA inflexible
<positive-number> <positive-number> 1 0 can grow and shrink with extent of growth depending on flex factor
@ankedsgn
ankedsgn / boltforms.bolt.yml
Last active August 22, 2018 10:28
Maak een Honeypot dmv een hidden field in de boltforms config
custom:
type: hidden
options:
label: 'Custom'
required: false
attr:
class: hidden
constraints: [ Blank ]