Skip to content

Instantly share code, notes, and snippets.

@amit08255
amit08255 / nodejs.md
Last active December 20, 2021 16:14
Install NodeJS Windows without Admin
@amit08255
amit08255 / download-file.js
Created December 1, 2021 08:59 — forked from javilobo8/download-file.js
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@amit08255
amit08255 / locale.md
Created November 30, 2021 03:35
Fix Linux Locale Error

Run below commands:

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
sudo locale-gen "en_US.UTF-8"

Restart your computer

@amit08255
amit08255 / linkedList.js
Created November 16, 2021 16:34 — forked from codesections/linkedList.js
A simple linked list implemented in JavaScript
const LinkedList = function() {
this.head = null;
this.tail = null;
};
LinkedList.prototype.addToTail = function(value) {
const newTail = { value, next: null };
if (this.tail) {
this.tail.next = newTail;
@amit08255
amit08255 / firefox-addon.md
Last active October 27, 2021 10:02
Installing custom addon in firefox

1. Disabling signing required in config

  • Type - about:config in address bar and press enter.
  • Search for xpinstall.signatures.required and double click to disable

2. Signing addon file

  • First select all addon files and convert to .zip file and rename extension to .xpi
  • Initialize the nodejs project in your computer using command npm init.
@amit08255
amit08255 / react-phone-book.js
Created October 23, 2021 05:21 — forked from roshanlabh/react-phone-book.js
Coderbyte - React Phone Book [solution]
import React, { useState } from "react";
import ReactDOM from "react-dom";
const style = {
table: {
borderCollapse: "collapse",
},
tableCell: {
border: "1px solid gray",
margin: 0,
@amit08255
amit08255 / bspwm.md
Created October 10, 2021 01:52
Bspwm Cheatsheet

bspwm/sxhkd cheat sheet

Common keys

@amit08255
amit08255 / PreventCopyPaste.js
Last active October 6, 2021 08:49 — forked from ststeiger/PreventCopyPaste.js
Prevent copy-paste and contextmenu
document.oncontextmenu = function(event) {
event.preventDefault();
event.stopPropagation();
return false;
};
document.addEventListener('contextmenu', function(event){
event.preventDefault();
event.stopPropagation();
@amit08255
amit08255 / bithack.cc
Created July 24, 2021 11:47 — forked from stephenLee/bithack.cc
bit manipulation tricks(collections)
/*
* Reference:
* http://www.quora.com/Computer-Programming/What-are-some-cool-bit-manipulation-tricks-hacks
* http://www.catonmat.net/blog/low-level-bit-hacks-you-absolutely-must-know/
*/
#include <iostream>
#include <string.h>
using namespace std;
@amit08255
amit08255 / examples.js
Created July 4, 2021 07:03 — forked from dypsilon/examples.js
Lazy Continuation Monad in JavaScript
const Cont = require('./lazy-continuation');
// pointed version
const c = Cont.of(5) // initial value
.chain((x) => {
return Cont.of(x + 5); // synchronous computation
})
.chain((x) => { // async computation
return new Cont((resolve) => {
setTimeout(() => resolve(x + 15), 500);