Skip to content

Instantly share code, notes, and snippets.

View paul-phan's full-sized avatar
🌏
Working from home

Minh Phan (Paul) paul-phan

🌏
Working from home
View GitHub Profile
@DakotaLMartinez
DakotaLMartinez / instructions.md
Last active July 16, 2024 09:10
Adding an SSH key to GitHub (Mac OS X or Linux)

You need to do this if you try this command:

ssh -T git@github.com

and you get something that says

git@github.com: Permission denied (public key).
@sindresorhus
sindresorhus / esm-package.md
Last active July 22, 2024 15:39
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
// Builds array of everything ahead of time
function collectAllItems() {
return [calculateFirst(), calculateSecond(), ...]
}
// This loop will end as soon as `isMatch(item)` is truthy.
// If the very first item in the array is a match, then we
// wasted all this time building the array in the first place.
for (let item of collectAllItems()) {
if (isMatch(item)) {
@paul-phan
paul-phan / facebook-plane-react.js
Last active August 1, 2018 03:09
Facebook Plane Reaction - paste to console
var hookFacebookReactionsCounter=0;function hookFacebookReactions(){var b='update-feedback',d=[{name:'fire',id:14},{name:'plane',id:15}];if(window.requireLazy){window.requireLazy(['UFICentralUpdates','UFIFeedbackTargets'],function(l){l.subscribe(b,function(o,p){var q=p.feedbacktarget.supportedreactions;if(q.length===6){for(var r=d.reverse(),s=Array.isArray(r),t=0,r=s?r:r[Symbol.iterator]();;){var u;if(s){if(t>=r.length)break;u=r[t++]}else{if(t=r.next(),t.done)break;u=t.value}var v=u;q.push(v.id)}p.feedbacktarget.supportedreactions=q,l.inform(b,p)}})});for(var e='',f=d,g=Array.isArray(f),h=0,f=g?f:f[Symbol.iterator]();;){var i;if(g){if(h>=f.length)break;i=f[h++]}else{if(h=f.next(),h.done)break;i=h.value}var k=i;e+='div[data-reaction=\''+k.id+'\'] div._4sm1:after { content: \' '+k.name+'\'; }'}var j=document.createElement('style');j.type='text/css',j.textContent=e,(document.head||document.body||document.documentElement).appendChild(j)}else console.log('Failed to inject Facebook Reactions hook.'),hookFacebookRea
@gricard
gricard / webpack4upgrade.md
Last active February 29, 2024 20:23
Just some notes about my attempt to upgrade to webpack 4

If you enjoyed reading this, I'm intending to do more blogging like this over here: https://cdgd.tech

This is not a complaint about Webpack or v4 in any way. This is just a record of my process trying it out so I could provide feedback to the webpack team

Hmm... I don't see any docs for 4.0 on https://webpack.js.org. I guess I'll just wing it. All I need to do is npm i -D webpack@next, right?

+ webpack@4.0.0-beta.2
@alirobe
alirobe / reclaimWindows10.ps1
Last active July 3, 2024 09:36
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###
@odan
odan / xampp_php7_xdebug.md
Last active June 28, 2024 12:58
Installing Xdebug for XAMPP
@paulirish
paulirish / what-forces-layout.md
Last active July 22, 2024 06:32
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
@derMani
derMani / GridStream.js
Last active September 5, 2020 19:07 — forked from psi-4ward/GridStream.js
NodeJS MongoDB-GridFS Video range stream exampleLets your browser seek/jump wihin the video-playback.
var express = require('express');
var app = express();
var mongo = require('mongodb');
var MongoClient = require('mongodb').MongoClient;
var GridStore = mongo.GridStore;
var ObjectID = require('mongodb').ObjectID;
function StreamGridFile(req, res, GridFile) {
@staltz
staltz / introrx.md
Last active July 22, 2024 09:31
The introduction to Reactive Programming you've been missing