Skip to content

Instantly share code, notes, and snippets.


Daniel Mascena danielmascena

Block or report user

Report or block danielmascena

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
if (! { = function(x, y) {
// SameValue algorithm
if (x === y) { // Steps 1-5, 7-10
// Steps 6.b-6.e: +0 != -0
return x !== 0 || 1 / x === 1 / y;
} else {
// Step 6.a: NaN == NaN
return x !== x && y !== y;
gaearon / index.html
Last active Jan 20, 2020
Add React in One Minute
View index.html
<!DOCTYPE html>
<meta charset="UTF-8" />
<title>Add React in One Minute</title>
<h2>Add React in One Minute</h2>
<p>This page demonstrates using React with no build tooling.</p>



None of the string methods modify this – they always return fresh strings.

  • charAt(pos: number): string ES1

    Returns the character at index pos, as a string (JavaScript does not have a datatype for characters). str[i] is equivalent to str.charAt(i) and more concise (caveat: may not work on old engines).

vkarpov15 / promise1.js
Created Apr 5, 2018
Write Your Own Node.js Promise Library from Scratch, Part 1
View promise1.js
class MyPromise {
constructor(executor) {
if (typeof executor !== 'function') {
throw new Error('Executor must be a function');
// Internal state. `$state` is the state of the promise, and `$chained` is
// an array of the functions we need to call once this promise is settled.
this.$state = 'PENDING';
this.$chained = [];
View Repeatable example of lit-html issue.html
<!DOCTYPE html>
<div id=target></div>
<script type="module" charset="utf-8">
import { html, render } from './lit-html.js';
const renderForm = (entity) => {
const e = [];
Object.keys(entity).forEach((attr) => {
evantoli /
Last active Jan 21, 2020
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

jacomyal /
Created Dec 12, 2014
A problem with Function.prototype.bind polyfill

I met an issue with the common polyfill for Function.prototype.bind, found on the MDN, and I do not know where to fix it.

Here is the polyfill:

if (!Function.prototype.bind) {
  Function.prototype.bind = function(oThis) {
    if (typeof this !== 'function') {
      // closest thing possible to the ECMAScript 5
      // internal IsCallable function
      throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
View table.css
table { display: table }
tr { display: table-row }
thead { display: table-header-group }
tbody { display: table-row-group }
tfoot { display: table-footer-group }
col { display: table-column }
colgroup { display: table-column-group }
td, th { display: table-cell }
caption { display: table-caption }
jcgregorio / How_to_use.html
Last active Dec 6, 2019
HTML Templating using the HTML <template> element and exactly 100 lines of JS. A cleaned up version of this code is now available at
View How_to_use.html
<!DOCTYPE html>
<meta charset="utf-8" />
<script src="templating.js" type="text/javascript" charset="utf-8"></script>
<template id=t>
magicznyleszek /
Last active Jan 14, 2020
CSS Selectors Cheatsheet

CSS Selectors Cheatsheet

Element selectors

Element -- selects all h2 elements on the page

h2 {
    foo: bar;
You can’t perform that action at this time.