Skip to content

Instantly share code, notes, and snippets.

View ivan-marquez's full-sized avatar

Jose Ivan Marquez ivan-marquez

View GitHub Profile
@ivan-marquez
ivan-marquez / framework-sizes.md
Created February 26, 2021 12:54 — forked from Restuta/framework-sizes.md
Sizes of JS frameworks, just minified + minified and gzipped, (React, Angular 2, Vue, Ember)

Below is the list of modern JS frameworks and almost frameworks – React, Vue, Angular, Ember and others.

All files were downloaded from https://cdnjs.com and named accordingly. Output from ls command is stripped out (irrelevant stuff)

As-is (minified)

$ ls -lhS
566K Jan 4 22:03 angular2.min.js
@ivan-marquez
ivan-marquez / terminal-keybind.ahk
Created January 15, 2021 00:08 — forked from atruskie/terminal-keybind.ahk
AutoHotkey script to bind Win+~ keyboard shortcut to Windows Terminal
#NoEnv
#SingleInstance force
SendMode Input
DetectHiddenWindows, on
SetWinDelay, 0
#`::
terminal := WinExist("ahk_exe WindowsTerminal.exe")
if (terminal)
{
@ivan-marquez
ivan-marquez / BabylonjsVisual.ts
Created December 6, 2020 02:24 — forked from AndyCross/BabylonjsVisual.ts
Use BabylonJS in PowerBI
declare module BABYLON {
export class Engine {
constructor(canvas:HTMLElement, antialias:boolean);
runRenderLoop(it:any);
resize();
}
export class Scene {
constructor(engine:Engine);
render();
}
@ivan-marquez
ivan-marquez / awsgobuild.sh
Created October 19, 2019 20:53
Bash script to build AWS Lambda functions in Go
export GO111MODULE=on
env GOOS=linux go build -ldflags="-s -w" -o main
zip main.zip main
@ivan-marquez
ivan-marquez / user_test.go
Created September 8, 2019 01:01 — forked from wrunk/user_test.go
Golang unit test for panic scenario
func TestUserFail(t *testing.T) {
func() {
defer func() {
if r := recover(); r == nil {
t.Errorf("TestUserFail should have panicked!")
}
}()
// This function should cause a panic
CreateUser(12, "hello")
@ivan-marquez
ivan-marquez / online_checker.go
Last active July 24, 2019 19:26
Simple goroutines and channels implementation for concurrent processing.
/*
* Package statuschecker checks the status of a given url and prints the online status
* to the console.
*/
package main
import (
"fmt"
"net/http"
@ivan-marquez
ivan-marquez / polling.js
Last active February 3, 2024 00:13
Long polling implementation in Js
const axios = require('axios').default;
function getAPIClient() {
const axiosConfig = {
baseURL: 'https://csrng.net/csrng/csrng.php',
timeout: 5000,
};
return axios.create(axiosConfig);
}
@ivan-marquez
ivan-marquez / bdd.json
Created June 13, 2019 20:35
VS Code snippet for BDD unit test with Jest
{
"BDD Unit Test": {
"prefix": "bdd",
"body": [
"describe('Given $1', () => {",
" afterEach(() => {",
" jest.resetAllMocks();",
" });",
" describe('when $2', () => {",
" test('then $3', async () => {",
@ivan-marquez
ivan-marquez / monitor.js
Created March 8, 2019 12:55
monitor the processing time of any functions
module.exports = (start, tag) => {
if (start) {
let endTime = process.hrtime(start)
let duration = parseInt((endTime[0] * 1000) + (endTime[1] / 1000000))
console.log(`Duration for ${tag}: ${duration} msec`)
} else {
return process.hrtime()
}
}
@ivan-marquez
ivan-marquez / scroll-to-bottom.js
Created January 7, 2019 11:41
Detect when scroll reaches bottom of window.
export function scrolledToBottom(window, marginFromBottom = 0) {
const documentBody = window.document.body;
const documentElement = window.document.documentElement;
const scrollTop =
(documentElement && documentElement.scrollTop) || documentBody.scrollTop;
const scrollHeight =
(documentElement && documentElement.scrollHeight) ||
documentBody.scrollHeight;