Skip to content

Instantly share code, notes, and snippets.

View pawarvijay's full-sized avatar

vijay pawar pawarvijay

View GitHub Profile
[
{
"constant": false,
"inputs": [],
"name": "draw",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
@ksmithut
ksmithut / .dockerignore
Last active April 26, 2024 14:04
Node Docker Compose nodemon
node_modules
@emilioriosvz
emilioriosvz / rabbitasyncawait.js
Created September 7, 2017 12:04
rabbitmq async await
var amqp = require('amqplib')
var open = require('amqplib').connect('amqp://localhost');
const connect = (url = 'amqp://localhost') => {
return new Promise((resolve, reject) => {
amqp.connect(url)
.then(conn => resolve(conn))
.catch(err => reject(err))
})
@ziluvatar
ziluvatar / token-generator.js
Last active April 11, 2024 07:10
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');
@bvaughn
bvaughn / react-lifecycle-cheatsheet.md
Last active March 2, 2023 13:29
React lifecycle cheatsheet

React lifecycle cheatsheet

Method Side effects1 State updates2 Example uses
Mounting
componentWillMount Constructor equivalent for createClass
render Create and return element(s)
componentDidMount DOM manipulations, network requests, etc.
Updating
componentWillReceiveProps Update state based on changed props
@bertrandmartel
bertrandmartel / aggregation_lookup.md
Last active December 22, 2023 13:32
MongoDB $lookup aggregation example

MongoDB $lookup aggregation

SO link

db.votes.aggregate([{
    $lookup: {
        from: "users",
        localField: "createdBy",
        foreignField: "_id",
@yunghoy
yunghoy / gist:a425f91824d26461bb2e3653bc56ebbf
Last active June 2, 2022 00:34
AMQP library (RabbitMQ) - async/await
alias babel-node='babel-node --presets stage-0'
------ RECV ------
// babel-node recv2.js "#"
// babel-node recv2.js "kern.*"
const amqp = require('amqplib');
const args = process.argv.slice(2);
if (args.length == 0) {
@Restuta
Restuta / framework-sizes.md
Last active March 7, 2024 00:01
Sizes of JS frameworks, just minified + minified and gzipped, (React, Angular 2, Vue, Ember)

Below is the list of modern JS frameworks and almost frameworks – React, Vue, Angular, Ember and others.

All files were downloaded from https://cdnjs.com and named accordingly. Output from ls command is stripped out (irrelevant stuff)

As-is (minified)

$ ls -lhS
566K Jan 4 22:03 angular2.min.js
@jpospychala
jpospychala / gist:69d783f2eeeea1a9450e
Last active December 21, 2021 16:44
create DigitalOcean droplet from shell with curl and rcli
# this script expects $DOTOKEN variable with your digital ocean token
# this script gets or creates smallest DO droplet and remotely executes script on it
# afterwards, droplet is destroyed
DROPLETNAME=example.com
DOHOME="https://api.digitalocean.com/v2"
cat <<EOF > .curlargs
-s
-H "Authorization: Bearer $DOTOKEN"
@soheilhy
soheilhy / nginxproxy.md
Last active March 22, 2024 08:54
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers