Skip to content

Instantly share code, notes, and snippets.

View samuelastech's full-sized avatar
🎯
Focusing

Samuel A. Souza samuelastech

🎯
Focusing
View GitHub Profile
@adrianhajdin
adrianhajdin / cartItemStyles.js
Created November 28, 2020 16:30
Styles for an E-Commerce Web Tutorial
import { makeStyles } from '@material-ui/core/styles';
export default makeStyles(() => ({
media: {
height: 260,
},
cardContent: {
display: 'flex',
justifyContent: 'space-between',
},
@diego3g
diego3g / settings.json
Last active July 16, 2024 19:25
VSCode Settings (Updated)
{
"workbench.startupEditor": "newUntitledFile",
"editor.fontSize": 15,
"editor.lineHeight": 1.8,
"javascript.suggest.autoImports": true,
"javascript.updateImportsOnFileMove.enabled": "always",
"editor.rulers": [
80,
120
],
@HoweChen
HoweChen / opencv_from_base64.py
Last active March 19, 2024 20:20
[opencv_from_base64]read image from opencv with base64 encoding #OpenCV
import cv2
import numpy as np
import base64
image = "" # raw data with base64 encoding
decoded_data = base64.b64decode(image)
np_data = np.fromstring(decoded_data,np.uint8)
img = cv2.imdecode(np_data,cv2.IMREAD_UNCHANGED)
cv2.imshow("test", img)
cv2.waitKey(0)
@bradtraversy
bradtraversy / pipenv_cheat_sheet.md
Last active July 7, 2024 20:34
Pipenv cheat sheet for common commands

Pipenv Cheat Sheet

Install pipenv

pip3 install pipenv

Activate

pipenv shell
@qoomon
qoomon / conventional-commits-cheatsheet.md
Last active July 16, 2024 20:32
Conventional Commits Cheatsheet

Conventional Commit Messages

See how a minor change to your commit message style can make a difference.

Tip

Have a look at git-conventional-commits , a CLI util to ensure these conventions, determine version and generate changelogs

Commit Message Formats

Default

@nitin42
nitin42 / gc.js
Created September 23, 2017 17:50
Mark and Sweep Algorithm implementation
let HEAP = [];
const A = {
language: 'JavaScript'
};
HEAP.push(A);
const root = () => HEAP[0];
@ngot
ngot / multi-thread.js
Last active October 25, 2023 15:27
V8 Thread Demo
start(() => {
while(true)
{
print("a");
sleep(1000);
}
})
while(true)
{
@Rich-Harris
Rich-Harris / footgun.md
Last active July 8, 2024 03:54
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

@solenoid
solenoid / gist:1372386
Created November 17, 2011 04:49
javascript ObjectId generator
var mongoObjectId = function () {
var timestamp = (new Date().getTime() / 1000 | 0).toString(16);
return timestamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, function() {
return (Math.random() * 16 | 0).toString(16);
}).toLowerCase();
};