Skip to content

Instantly share code, notes, and snippets.

View jerosoler's full-sized avatar
:octocat:
Working from home

Jero Soler jerosoler

:octocat:
Working from home
View GitHub Profile
@steveruizok
steveruizok / visibility-polygon.ts
Created November 21, 2022 23:49
Get a visibility polygon (for shadow casting).
// segments are all of the segments in all of the shapes in the scene
// point is light point
// viewport is top left, top right, bottom right, bottom left
function getVisibilityPolygon(segments: Segment[], point: Point, viewport: Point[]) {
const brokenSegments: Segment[] = []
const viewportMinCorner = viewport[0]
const viewportMaxCorner = viewport[2]
@midudev
midudev / README.md
Created October 15, 2022 17:52
Transcribe vídeo de YouTube con Whisper e Inteligencia Artificial

Requisitos

Necesitas tener instalado Python 3.9 e instalar la dependencia de Whisper y PyTube:

pip install git+https://github.com/openai/whisper.git
pip install pytube

También necesitas tener instalado ffmpeg. Según tu sistema operativo se instala de esta forma:

@DavidWells
DavidWells / javascript-proxy-as-rest-client.js
Last active October 6, 2023 18:39
Using a javascript proxy as low code REST client
/* Using a JavaScript proxy for a super low code REST client */
// via https://dev.to/dipsaus9/javascript-lets-create-aproxy-19hg
// also see https://towardsdatascience.com/why-to-use-javascript-proxy-5cdc69d943e3
// also see https://github.com/fastify/manifetch
// also see https://github.com/flash-oss/allserver
// and https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb
const createApi = (url) => {
return new Proxy({}, {
get(target, key) {
@steveruizok
steveruizok / getPerfectDashProps.ts
Last active February 19, 2024 00:38
Get balanced stroke dash array and stroke dash offset for an ellipse.
/**
* Get balanced dash-strokearray and dash-strokeoffset properties for a path of a given length.
* @param length The length of the path.
* @param strokeWidth The shape's stroke-width property.
* @param style The stroke's style: "dashed" or "dotted" (default "dashed").
* @param snap An interval for dashes (e.g. 4 will produce arrays with 4, 8, 16, etc dashes).
*/
export function getPerfectDashProps(
length: number,
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var domStyle = document.createElement("style");
domStyle.append(
'* { color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }\
* * { background-color: rgba(0,255,0,.2) !important; }\
* * * { background-color: rgba(0,0,255,.2) !important; }\
* * * * { background-color: rgba(255,0,255,.2) !important; }\
* * * * * { background-color: rgba(0,255,255,.2) !important; }\
@Jignesh-Darji
Jignesh-Darji / QR Code Scanner Using HTML.html
Created April 9, 2018 09:19
QR Code Scanner Using HTML
<html>
<head>
<style>
body, input {font-size:14pt}
input, label {vertical-align:middle}
.qrcode-text {padding-right:1.7em; margin-right:0}
.qrcode-text-btn {display:inline-block; background:url('http://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2017/07/1499401426qr_icon.svg') 50% 50% no-repeat; height:1em; width:1.7em; margin-left:-1.7em; cursor:pointer}
.qrcode-text-btn > input[type=file] {position:absolute; overflow:hidden; width:1px; height:1px; opacity:0}
</style>
@LeoAref
LeoAref / dispatcher.js
Last active October 5, 2022 11:04
Simple event dispatcher implementation using JavaScript
export class Dispatcher {
constructor () {
this.events = {};
}
addListener (event, callback) {
// Check if the callback is not a function
if (typeof callback !== 'function') {
console.error(`The listener callback must be a function, the given type is ${typeof callback}`);
return false;