Skip to content

Instantly share code, notes, and snippets.

View dasilvacontin's full-sized avatar
🔥
Doing it

David da Silva dasilvacontin

🔥
Doing it
View GitHub Profile
@greggman
greggman / use-strict.md
Last active August 29, 2015 14:18
Can it really be right that strict mode in JavaScript can break your code?

So I had a sample that wasn't working in firefox. It had code like ths

"use strict";
var devicePixelRation = window.devicePixelRatio || 1;

That worked fine on Chrome but broke on Firefox with

TypeError: setting a property that has only a getter

So first thing I learned something I didn't know. Variables declared with var in the global scope

@holman
holman / tmobile.sh
Created June 29, 2015 21:32
Will someone destroy Comcast already
# Manually download each month's call history from t-mobile.com and toss them in
# a directory. Or do it automatically using computers, who cares.
#
# Install spark: https://github.com/holman/spark
cat * | grep 266-2278 | sort | cut -d, -f5 | spark
# ▂█▁▃▅
echo "fuck comcastttttttttttttttttttttttttttttttttttttttttt"
# ⒻⓊⒸⓀ ⒸⓄⓂⒸⒶⓈⓉ
@paulirish
paulirish / what-forces-layout.md
Last active May 20, 2024 17:15
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@WengerK
WengerK / README.md
Last active February 3, 2021 10:47
MacOS - Trigger Notification Center when long running commands finishes

Article Ressources - MacOS - Trigger Notification Center when long running commands finishes

This is the Gist repository for my article MacOS - Trigger Notification Center when long running commands finishes.

Be aware that this article has been wrote for the Blog of Antistatique — Web Agency in Lausanne, Switzerland. A place where I work as Full Stack Web Developer.

Feel free to read it the full article on Medium or check it out on Antistatique.

@jesperorb
jesperorb / cors.md
Last active February 21, 2024 14:17
Handle CORS Client-side

Handle CORS Client-side

Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources (e.g. fonts) on a web page to be requested from another domain outside the domain from which the first resource was served. This is set on the server-side and there is nothing you can do from the client-side to change that setting, that is up to the server/API. There are some ways to get around it tho.

Sources : MDN - HTTP Access Control | Wiki - CORS

CORS is set server-side by supplying each request with additional headers which allow requests to be requested outside of the own domain, for example to your localhost. This is primarily set by the header:

Access-Control-Allow-Origin
type Safe<T> = { [P in keyof T]: string };
function getSafeEnvironment<T extends {}>(e: T): Safe<T> {
return new Proxy(e, {
get: function(env: any, key: string): string {
const value: any = env[key];
if (value == null) {
throw new Error("'" + key + "' environment variable is not set.");
}
return value;