Skip to content

Instantly share code, notes, and snippets.

View sibelius's full-sized avatar
🦈
give me a feedback https://entria.feedback.house/sibelius

Sibelius Seraphini sibelius

🦈
give me a feedback https://entria.feedback.house/sibelius
View GitHub Profile
@tomfa
tomfa / imports-add-ext.js
Created September 20, 2023 20:57
Codemod convert commonJS to esm import path style
/*
jscodeshift transform: adds the '.js' extension
to all import declarations with relative specifiers:
From './file' to './file.js', and
from '../file' to '../file.js'.
*/
module.exports = function (fileInfo, api) {
@steve981cr
steve981cr / electron-store-fix.md
Created August 30, 2023 20:17
Electron-Store interim fix to Electron Forge packaging error

Electron-Store interim fix to Electron Forge packaging error

The problem: Electron's recommended app packager is Electron Forge. My app uses electron-store to persist small amounts of data used in the main process. It works fine in development mode but for some reason when I package the app with Electron-forge it will thrown an error and crash the app.

Interim solution: My solution was to build my own super simple storage module using the same file and method names used by electron store. It is not as robust as electron-store but it was sufficient for my needs so I thought I would pass this on to anyone else running into this issue. This is not an npm package, rather you can just copy the code below to make your own local module. If you are already using electron-store you do not have to modify any of your code except for adding the relative path to your module in the require statement.


Electron-store.js

Create a file named electron

@doziestar
doziestar / docker-compose.yml
Last active August 16, 2023 14:28
tls: failed to verify certificate: x509: certificate signed by unknown authority
`docker-compose`
server:
container_name: hubhub-server
# image: '${DOCKER_USER}/hubhubserver:latest'
extra_hosts:
- host.docker.internal:host-gateway
restart: always
build:
context: .
@noghartt
noghartt / cc.md
Last active June 8, 2024 06:34
Resources to learn more about Computer Science and related stuffs
@dionisioviei
dionisioviei / gist:b7698621159eaa08833faad0c2a56ccf
Last active August 7, 2023 20:43
CSP Content tag Policy example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta
http-equiv="Content-Security-Policy"
content="default-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; connect-src 'self' ws: wss:; media-src 'self' data: blob:;"
/>
@igor9silva
igor9silva / generate-thum.js
Created May 31, 2023 11:11
Generate Thumbnail on S3 upload
// dependencies
const util = require('util');
const sharp = require('sharp');
const AWS = require('aws-sdk');
// get reference to S3 client
const s3 = new AWS.S3();
exports.handler = async (event, context, callback) => {
@alexedwards
alexedwards / Makefile
Last active March 15, 2025 21:40
Boilerplate Makefile for Go projects
# Change these variables as necessary.
main_package_path = ./cmd/example
binary_name = example
# ==================================================================================== #
# HELPERS
# ==================================================================================== #
## help: print this help message
.PHONY: help
@mauvieira
mauvieira / c-dsa-checklist.md
Last active April 27, 2023 21:55
c and dsa checklist

C lang

  • how to compile: GCC or Clang
  • variables, data types, arrays, structures, functions and pointers
  • operators: arithmetic, relational, logic, bitwise, etc
  • control flow structures
  • standard library

projects

  • file manager: crud with folders and files
  • text editor
@Xavier577
Xavier577 / websocket_nodejs_implementation.md
Last active January 18, 2025 00:38
Implementing a websocket server without any libraries with raw nodejs

Code snippet

import { createServer } from "http";
import crypto from "crypto";

const PORT = 8001;

// this is from the web-socket specification and not something that is generated
const WEBSOCKET_MAGIC_STRING_KEY = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";

Toda Monad é um tipo genérico. Para um tipo genérico ser uma monad, ele tem que suportar a seguinte "interface":

Dado que nossa monad é o tipo M onde A é algum tipo de parâmetro, devem existir as seguintes funçÕes:

function pure(A): M<A>
function bind<B>(M<A>, A -> M<B>): M<B>

A função pure "injeta" um valor dentro da monad com contexto "neutro".