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 %}
@Kcnarf
Kcnarf / .block
Last active December 10, 2018 11:09
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 May 3, 2024 12:56
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

@Rich-Harris
Rich-Harris / footgun.md
Last active August 15, 2024 21:11
Top-level `await` is a footgun

Edit — February 2019

This gist had a far larger impact than I imagined it would, and apparently people are still finding it, so a quick update:

  • TC39 is currently moving forward with a slightly different version of TLA, referred to as 'variant B', in which a module with TLA doesn't block sibling execution. This vastly reduces the danger of parallelizable work happening in serial and thereby delaying startup, which was the concern that motivated me to write this gist
  • In the wild, we're seeing (async main(){...}()) as a substitute for TLA. This completely eliminates the blocking problem (yay!) but it's less powerful, and harder to statically analyse (boo). In other words the lack of TLA is causing real problems
  • Therefore, a version of TLA that solves the original issue is a valuable addition to the language, and I'm in full support of the current proposal, which you can read here.

I'll leave the rest of this document unedited, for archaeological