Skip to content

Instantly share code, notes, and snippets.

View AshikNesin's full-sized avatar

Ashik Nesin AshikNesin

View GitHub Profile
@AshikNesin
AshikNesin / package.json
Created February 14, 2025 17:24
Sitemap Broken or Redirect Link Checker
{
"name": "sitemap-checker",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
@AshikNesin
AshikNesin / vercel-add-custom-domain.js
Created January 16, 2025 05:29
Add custom domain to a vercel project using Vercel API
import axios from "axios";
const AUTH_TOKEN = process.env.VERCEL_AUTH_TOKEN;
const projectId = process.env.PROJECT_ID;
export const addDomainToProject = async (domain) => {
const config = {
headers: {
Authorization: `Bearer ${AUTH_TOKEN}`,
},
@AshikNesin
AshikNesin / export.js
Created April 20, 2022 19:19 — forked from katoen/export.js
Export Wallet by BudgetBakers records to JSON
// Source for Jake Archibald's idb https://github.com/jakearchibald/idb/blob/v3.0.2/build/idb.js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = global || self, factory(global.idb = {}));
}(this, function (exports) { 'use strict';
function toArray(arr) {
return Array.prototype.slice.call(arr);
}
function detect() {
if (typeof navigator !== 'undefined') {
return parseUserAgent(navigator.userAgent);
}
return getNodeVersion();
}
function detectOS(userAgentString) {
var rules = getOperatingSystemRules();
@AshikNesin
AshikNesin / Sidebar.js
Created July 17, 2018 06:53
React Sidebar
import React from "react";
import ReactDOM from "react-dom";
import "./styles.css";
import classNames from "classnames";
class Sidebar extends React.Component {
constructor(props) {
super(props);
this.state = {
showMenu: false
@AshikNesin
AshikNesin / letsencrypt_2017.md
Created April 8, 2018 09:46 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two main modes to run the Let's Encrypt client (called Certbot):

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80).

In the following, we're setting up mydomain.com. HTML is served from /var/www/mydomain, and challenges are served from /var/www/letsencrypt.

@AshikNesin
AshikNesin / file-upload-local-url.js
Created March 21, 2018 13:14
Get URL of the selected file
$('#file-upload').change(function(e) {
const file = e.target.files[0]
console.log(URL.createObjectURL(file))
});
@AshikNesin
AshikNesin / base64-form-data.js
Last active February 22, 2025 17:30
Base64 image to multipart/form-data
const base64 = 'data:image/png;base64,....' // Place your base64 url here.
fetch(base64)
.then(res => res.blob())
.then(blob => {
const fd = new FormData();
const file = new File([blob], "filename.jpeg");
fd.append('image', file)
// Let's upload the file
// Don't set contentType manually → https://github.com/github/fetch/issues/505#issuecomment-293064470
@AshikNesin
AshikNesin / chrome-extension.js
Created July 19, 2017 06:44
Chrome Extension Close Current Page
chrome.tabs.query({ active: true, currentWindow: true }, tabs => {
chrome.tabs.remove(tabs[0].id);
});
@AshikNesin
AshikNesin / model-stop-video.js
Created June 16, 2017 06:50
Stop video if the model is closed
$(document).ready(function(){
$('.modal').each(function(){
var src = $(this).find('iframe').attr('src');
$(this).on('click', function(){
$(this).find('iframe').attr('src', '');
$(this).find('iframe').attr('src', src);
});