This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create milions of objects and save them into an array to keep the reference | |
// how much memory is available depends on the system, remove some of the 'objects' arrays if it crashes | |
// note: better to use a few arrays instead of putting everything in one - you might actually hit the limit of an array, not the memory limit | |
function objectFactory(id) { | |
return { | |
id, | |
prop: "lorem ipsum dolor sit atmet", | |
prop2: 123456 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create huge strings, then merge them together in a blob and download it as a file | |
// how much memory is available depends on the system, one "out" variable holds about 500mb, remove some if it crashes | |
// creates 1.93gb file | |
console.log(window.performance.memory) | |
let out1 = ""; | |
for(let i=0;i<10_000_000;i++) { | |
out1 += i + 'asdafsasf as fasf asf asf asf asf as fa f'; | |
} | |
let out2 = ""; | |
for(let i=0;i<10_000_000;i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Focus screen scroll position on a selected element when window resizes. | |
Have you ever developed a responsive design of an element but when you're resizing the window the element is jumping | |
up and down because the content around resizes too? This simple function will fix the top of the screen to the top | |
of the selected element when the window resizes. Just define the function in dev console and then run it. | |
Usage: resizeFocuser('div.element-to-focus-on'); | |
*/ | |
function resizeFocuser(selector, offset = 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Description: gets commits from all your GitHub repos since particular date - public and private repos (you will need access token for that) | |
Requirements: | |
- set your GitHub username | |
- get your GitHub access token | |
- make sure axios package is installed | |
Example: | |
//commits that are not older than 1 month (github api returns this activity from up to 90 days ago) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Description: gets total count of your GitHub repos - public and private (you will need access token for that) | |
Requirements: | |
- get your GitHub access token | |
- make sure axios package is installed | |
Example: await getReposCnt() | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am alestrunda on github. | |
* I am alestrunda1 (https://keybase.io/alestrunda1) on keybase. | |
* I have a public key ASBb8DXXcM5JBwp7WEuVW1fl6gqlwNSFk67o1sHASMnR0Qo | |
To claim this, I am signing this object: |