Skip to content

Instantly share code, notes, and snippets.

View brunodesde1987's full-sized avatar
🔺
uai

Bruno Carvalho brunodesde1987

🔺
uai
View GitHub Profile
@joeytwiddle
joeytwiddle / async-await-forEach-alternatives.md
Last active June 7, 2024 12:04
Do not use forEach with async-await

Do not use forEach with async-await

TLDR: Use for...of instead of forEach() in asynchronous code.

For legacy browsers, use for...i or [].reduce()

To execute the promises in parallel, use Promise.all([].map(...))

The problem

@noelbundick
noelbundick / LICENSE
Last active May 24, 2024 09:10
Exclude WSL installations from Windows Defender realtime protection
MIT License
Copyright (c) 2018 Noel Bundick
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@muralikg
muralikg / background.js
Last active June 8, 2023 09:19
puppeteer screen capture demo. Currently records 10 second video. Change the timeout in background.js with your own logic to stop the recording when necessary. Try with `node export.js`
/* global chrome, MediaRecorder, FileReader */
chrome.runtime.onConnect.addListener(port => {
let recorder = null
port.onMessage.addListener(msg => {
console.log(msg);
switch (msg.type) {
case 'REC_STOP':
console.log('Stopping recording')
if (!port.recorderPlaying || !recorder) {
import React from "react";
import { render } from "react-dom";
import Task from "data.task";
import TaskComponent from "./TaskComponent";
const users = [
{ id: 1, name: "User A", points: 45 },
{ id: 2, name: "User B", points: 22 },
{ id: 3, name: "User C", points: 79 },
{ id: 4, name: "User D", points: 54 }
{
"window.zoomLevel": -1,
"editor.fontFamily": "Operator Mono, Menlo, Monaco, 'Courier New', monospace",
"editor.fontSize": 29,
"editor.lineHeight": 40,
"editor.letterSpacing": 0.5,
"workbench.editor.tabSizing": "shrink",
"eslint.autoFixOnSave": true,
"eslint.alwaysShowStatus": true,
"html.format.enable": true,
@brettz9
brettz9 / speech.html
Last active September 15, 2018 17:08
SpeechRecognition
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<title>Speech transcription</title>
<style>
#transcriptionResults {
width: 100%;
height: 500px;
}
@kapunahelewong
kapunahelewong / angular-docs.md
Last active July 20, 2021 15:52
Contributing to the Angular docs

Make sure you've read the Angular.io CONTRIBUTING.md before starting out.

Angular.io local setup

Follow these steps when you are setting up the repo locally for the first time and would like to view your changes in the browser as you edit.

  1. Fork angular/angular.

In terminal:

@virolea
virolea / upload.js
Last active March 15, 2024 13:45
Tracking file upload progress using axios
upload(files) {
const config = {
onUploadProgress: function(progressEvent) {
var percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total)
console.log(percentCompleted)
}
}
let data = new FormData()
data.append('file', files[0])
@Zodiac1978
Zodiac1978 / functions.php
Last active November 4, 2021 22:29
Display Wordpress Home/Front Page at top of Admin Pages List
<?php
/**
* Plugin Name: Page List Optimizer
* Description: Push Front Page & Posts Page & Privacy Page to top of admin list
* Plugin URI: https://torstenlandsiedel.de
* Version: 1.0
* Author: Torsten Landsiedel
* Author URI: http://torstenlandsiedel.de
* Licence: GPL 2
* License URI: http://opensource.org/licenses/GPL-2.0
@hagemann
hagemann / slugify.js
Last active October 30, 2023 09:10
Slugify makes a string URI-friendly
function slugify(string) {
const a = 'àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìıİłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;'
const b = 'aaaaaaaaaacccddeeeeeeeegghiiiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz------'
const p = new RegExp(a.split('').join('|'), 'g')
return string.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(p, c => b.charAt(a.indexOf(c))) // Replace special characters
.replace(/&/g, '-and-') // Replace & with 'and'
.replace(/[^\w\-]+/g, '') // Remove all non-word characters