Skip to content

Instantly share code, notes, and snippets.

View hassan-jahan's full-sized avatar
😀

Hassan Jahan hassan-jahan

😀
View GitHub Profile
@snhasani
snhasani / disable-apps-verification-on-mac.md
Last active August 10, 2024 08:36
Disable Apps verification in the opening on Mac
  1. Open Terminal App; enter this command
sudo nano /etc/hosts
  1. Drop fllowing line into the end of the file and save it
0.0.0.0 ocsp.apple.com
@farmad
farmad / BIN_list.json
Last active April 18, 2019 17:45
List of Issuer Identification Numbers
{
"610433": "mellat",
"589905": "melli",
"170019": "melli",
"603799": "melli",
"603769": "saderat",
"639217": "keshavarzi",
"603770": "keshavarzi",
"589210": "sepah",
"627353": "tejarat",
@jkga
jkga / app-style.js
Created June 21, 2018 15:52
Adding style inside Vue components' template without using vue-loader
// app-style.js
// adding <style></style> directly inside template will result in error or empty element which
// this component is trying to address
// this will allow you to dynamically insert css inside Vue template without the use of vue loader
// or if you do not want to use .vue extension at all
// however it doesnt really apply scope css (for now).
export default {
name: 'app-style',
data: function(){
return {
@sarfarazansari
sarfarazansari / nodejs_aws_s3_file_upload.js
Last active March 15, 2024 09:40
How to upload files to AWS S3 with NodeJS - AWS-SDK? With the help of this library you can upload any kind of file to s3. (NODEJS, AWS-SDK, S3)
/**
* we are going to upload file to s3 via node js by using
* aws-sdk - required
* busboy - required
* uuid - optional - for image renaming purpose
* with this library you can upload any kind of file to s3 via node js.
*/
const AWS = require('aws-sdk');
const UUID = require('uuid/v4');
@DreaMinder
DreaMinder / A Nuxt.js VPS production deployment.md
Last active September 29, 2025 08:09
Deployment manual for a real-world project built with nuxt.js + koa + nginx + pm2

Example of deployment process which I use in my Nuxt.js projects. I usually have 3 components running per project: admin-panel SPA, nuxt.js renderer and JSON API.

This manual is relevant for VPS such as DigitalOcean.com or Vultr.com. It's easier to use things like Now for deployment but for most cases VPS gives more flexebillity needed for projects bigger than a landing page.

UPD: This manual now compatible with nuxt@2.3. For older versions deployment, see revision history.


Let's assume that you have entered fresh installation of Ubuntu instance via SSH. Let's rock:

@ziluvatar
ziluvatar / token-generator.js
Last active November 13, 2025 08:02
Example of refreshing tokens with jwt
/**
* Example to refresh tokens using https://github.com/auth0/node-jsonwebtoken
* It was requested to be introduced at as part of the jsonwebtoken library,
* since we feel it does not add too much value but it will add code to mantain
* we won't include it.
*
* I create this gist just to help those who want to auto-refresh JWTs.
*/
const jwt = require('jsonwebtoken');
@mattlockyer
mattlockyer / client.js
Last active February 22, 2023 18:30
s3 upload as stream using req stream (extra info in request header)
const file = this.input.files[0];
//console.log(file);
var xhr = new XMLHttpRequest();
xhr.addEventListener('load', (e) => {
console.log(e.target.response);
});
xhr.open('POST', host + 'fileuploadstream', true);
xhr.setRequestHeader('body', JSON.stringify({ id: 'somebucketfolderid', fn: file.name }));
xhr.send(file);
@greglinch
greglinch / datawrapper-install-instructions-detailed.md
Last active October 28, 2021 14:13
Datawrapper set up instructions: Below is a detailed, step-by-step guide for setting up your own installation of Datawrapper, an open-source data visualization tool. Questions? Suggestions? Please let a comment below. Happy installing!
.mt-0 {
margin-top: 0px !important;
}
.mt-5 {
margin-top: 5px !important;
}
.mt-10 {
margin-top: 10px !important;
}
.mt-15 {
@rheinardkorf
rheinardkorf / Hooks.js
Last active April 2, 2024 09:49
Simple WordPress like hooks system for JavaScript.
/**
* @file A WordPress-like hook system for JavaScript.
*
* This file demonstrates a simple hook system for JavaScript based on the hook
* system in WordPress. The purpose of this is to make your code extensible and
* allowing other developers to hook into your code with their own callbacks.
*
* There are other ways to do this, but this will feel right at home for
* WordPress developers.
*