Skip to content

Instantly share code, notes, and snippets.

View danielmascena's full-sized avatar
🎯
Focusing

Daniel Mascena danielmascena

🎯
Focusing
View GitHub Profile
@danielmascena
danielmascena / binary.js
Created November 29, 2023 23:00 — forked from mathewmariani/binary.js
A quick look at signed and unsigned integers in JavaScript.
var UInt4 = function (value) {
return (value & 0xF);
};
var Int4 = function (value) {
var ref = UInt4(value);
return (ref > 0x7) ? ref - 0x10 : ref;
};
var UInt8 = function (value) {
@danielmascena
danielmascena / gist:bf315c2736f9d05ef5799eba586c71f6
Created August 16, 2023 22:30
239. Sliding Window Maximum - testcases
https://leetcode.com/problems/sliding-window-maximum/
[1,3,-1,-3,5,3,6,7]
3
[1]
1
[-343,4165,-7225,1448,7642,5865,-5971,8390,-1327,401,5113,2366,7501,5195,8074,-7611,-4828,-1909,-8892,-9674,-9645,3129,3980,-8776,-5165,-8088,-448,-6403,-1284,-7526,-1236,6146,5182,-4356,-3357,5167,7963,-7878,-6543,4807,982,3066,-2204,1348,-6732,5092,-9582,3600,-3181,-9205,-8211,-9376,9341,-6982,-3497,-8207,7443,1832,-1937,8653,-1630,-8881,4814,-5060,4241,-3943,-9275,9014,-5840,6601,7877,3529,-5104,865,4312,5317,-9415,-5838,6400,9888,7055,4080,2643,6492,-1196,-7954,-4207,-4077,-9186,9602,4027,-395,288,241,6539,-6834,6289,-4178,-9995,8838,1174,-9908,-7977,-5177,-8838,-5581,6050,1354,4857,-5867,7384,-4154,9250,1167,-2406,-1834,-7189,-6273,328,9725,-9279,2786,-5165,-4485,1805,-6459,-1449,-7519,5177,704,-4097,-5906,-1113,5579,-730,9018,-2687,580,637,9902,-5612,-7034,-9380,211,-8463,-990,-4416,-3841,2269,-3718,-1255,-9701,4271,6065,-7172,-7146,-62,-5022,8958,-7167,-1357,-8026,-5958,2307,1325,5642,-9415,-2753,-1813,8552,-5235,-8109,-
@danielmascena
danielmascena / setTypeOf.js
Created August 19, 2020 20:36
A helper script to set checker types easily
/**
* @file This is a helper script to set checker types easily.
* @copyright Daniel Mascena 2020
* @function setTypeOf
*/
const setTypeOf = function() {
"use strict";
/** @constant
@danielmascena
danielmascena / getWeekDayString.js
Created August 5, 2020 21:01
A simple helper method to get the days of week
(function(Date) {
if (new RegExp(Date.name).test(Object.prototype.toString.call(new Date)) && !Date.prototype.getWeekDayString) {
const WEEKDAYS = ["SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY"];
Date.prototype.getWeekDayString = function() {
return WEEKDAYS[this.getDay()];
};
}
})(globalThis && globalThis.Date || (window && window.Date || global && global.Date));
/**
* An immediately-invoked function expression (or IIFE, pronounced "iffy") is a JavaScript programming language idiom
* which produces a lexical scope using JavaScript's function scoping.
*/
// keep things outside the global scope plz
(function (window, document, undefined) {
'use strict';
*{box-sizing: border-box;}
body{font-family: Arial, sans-serif;mrgi }
.container {
background: #ccc;
border: 1px solid;
}
.container:after {
content: '';
display: table;
@danielmascena
danielmascena / dabblet.css
Last active July 21, 2017 19:49
Untitled
*{box-sizing: border-box;}
body{font-family: Arial, sans-serif;}
.container {
background: #ccc;
border: 1px solid;
}
.container:after {
content: '';
display: table;
@danielmascena
danielmascena / dabblet.css
Created July 14, 2017 15:10
CSS Flexible Layout Module - flex property
/**
* CSS Flexible Layout Module - flex property
*/
* { transition: all 2s; box-sizing: border-box;}
body {
background: #bfbfbf;
}
header,aside,.mainContent,.extraDiv,footer {
padding: 1em;
font-size: 1.4em;
@danielmascena
danielmascena / dabblet.css
Created July 14, 2017 15:10
CSS Flexible Layout Module
/**
* CSS Flexible Layout Module
*/
body {
background: #bfbfbf;
min-height: 100%;
}
header {
background-color: blue;
min-height: 100px;
@danielmascena
danielmascena / dabblet.css
Created July 14, 2017 15:10
CSS Flexible Layout Module - extra div
/**
* CSS Flexible Layout Module - extra div
*/
body {
background: #bfbfbf;
min-height: 100%;
}
header {
background-color: blue;
min-height: 100px;