Skip to content

Instantly share code, notes, and snippets.

View marianoviola's full-sized avatar

Mariano Viola marianoviola

View GitHub Profile
@NoFishLikeIan
NoFishLikeIan / README.md
Created July 25, 2019 09:20
Intro to advanced types ts

Typescript for the young and free

Some "advanced" types

The backend returns some optional fields but you want to write a function that makes those optional fields nullable. Why? No apperent reason.

type Response = {
  name: string;
 age?: number;
@illvart
illvart / meta-seo.njk
Last active March 10, 2020 22:10
My Eleventy project meta-seo.njk
{% if permalink == "/" %}
{% set canonicalUrl = metadata.canonicalUrl %}
{% else %}
{% set canonicalUrl = metadata.canonicalUrl + page.url %}
{% endif %}
<link rel="canonical" href="{{ canonicalUrl }}">
{# Social meta #}
{% if section == "articles" %}
<meta property="og:type" content="blog">
{% else %}
@jakub-g
jakub-g / async-defer-module.md
Last active March 24, 2025 07:50
async scripts, defer scripts, module scripts: explainer, comparison, and gotchas

<script> async, defer, async defer, module, nomodule, src, inline - the cheat sheet

With the addition of ES modules, there's now no fewer than 24 ways to load your JS code: (inline|not inline) x (defer|no defer) x (async|no async) x (type=text/javascript | type=module | nomodule) -- and each of them is subtly different.

This document is a comparison of various ways the <script> tags in HTML are processed depending on the attributes set.

If you ever wondered when to use inline <script async type="module"> and when <script nomodule defer src="...">, you're in the good place!

Note that this article is about <script>s inserted in the HTML; the behavior of <script>s inserted at runtime is slightly different - see Deep dive into the murky waters of script loading by Jake Archibald (2013)

@Kcnarf
Kcnarf / .block
Last active March 26, 2025 23:13
Online Impossible Figure Builder
license: lgpl-3.0
@lucafalasco
lucafalasco / frontend-ranking.md
Last active August 3, 2018 11:53
Frontend Ranking

Front End Ranking

  • Tell us what was your approach with the project, i.e from the inspiration to the very first steps (sketches, tasks planning, design prototype, code prototype). Don't worry if the process was more "freestyle", if this is the case just describe how you wouly approach to a new project given an appropriate timeline.

  • Tell us about an interesting nontrivial bug/issue you encountered in your code and how you solved it, or if it's not solved yet, try to come up with a set of steps to fix it. It can be something related to external APIs, UI elements interactions, data visualization, build tooling etc..

  • Tell us about the library you used for the data visualizations and why you chose that one instead of others.

@mattdesl
mattdesl / animated-grid.js
Created July 27, 2018 15:45
animated grid lines
const canvasSketch = require('canvas-sketch');
const { lerp } = require('./util/math');
const settings = {
animate: true,
duration: 3,
dimensions: [ 640, 640 ],
scaleToView: true,
playbackRate: 'throttle',
fps: 24
@gaearon
gaearon / prepack-gentle-intro-1.md
Last active March 22, 2025 07:22
A Gentle Introduction to Prepack, Part 1

Note:

When this guide is more complete, the plan is to move it into Prepack documentation.
For now I put it out as a gist to gather initial feedback.

A Gentle Introduction to Prepack (Part 1)

If you're building JavaScript apps, you might already be familiar with some tools that compile JavaScript code to equivalent JavaScript code:

  • Babel lets you use newer JavaScript language features, and outputs equivalent code that targets older JavaScript engines.
@Rich-Harris
Rich-Harris / README.md
Created November 24, 2017 16:44
how svelte/store could work

Bear with me while I think aloud about this (please comment there, not here!). Goals:

  • Minimal boilerplate
  • Familiar API
  • Preserve Svelte's built-in optimisations
  • Support use cases like hot-reloading and custom devtools

Let's start with a single store that is external to the component tree. Our top-level <App> component connects to it:

@1wheel
1wheel / README.MD
Created January 15, 2017 15:34
you-draw-it
@koenbok
koenbok / mac-tweaks.md
Last active April 23, 2022 22:37
My Favorite Mac Tweaks

Skip verifying disk images

defaults write com.apple.frameworks.diskimages skip-verify true

Always hide the Desktop

defaults write com.apple.finder CreateDesktop false; killall Finder

Make terminal logins fast

touch ~/.hushlogin

Disable most animations