Skip to content

Instantly share code, notes, and snippets.

View pawarvijay's full-sized avatar

vijay pawar pawarvijay

View GitHub Profile
@flores
flores / gist:1387621
Created November 23, 2011 01:05
npm list = "UNMET DEPENDENCY". k, npm install module. same module now becomes "extraneous"
shark@0.0.1 /var/lib/jenkins/workspace/shark
├─┬ express@2.4.6
│ ├─┬ connect@1.8.0
│ │ └── UNMET DEPENDENCY formidable 1.0.x
│ ├── mime@1.2.4
│ └── qs@0.3.2
├── hiredis@0.1.12
├─┬ optimist@0.2.6
│ └── wordwrap@0.0.2
├── redis@0.6.7
[
{
"constant": false,
"inputs": [],
"name": "draw",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
@sanderhouttekier
sanderhouttekier / install_robomongo.sh
Created April 28, 2014 06:13
This file installs robomongo on your ubuntu / mint linux install
#!/bin/bash -e
# Script for installing Robomongo on Ubuntu.
# Copyright 2013 Binary Birch Tree
# http://www.binarybirchtree.com
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
@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))
})
@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"
@simonexmachina
simonexmachina / post.md
Created May 8, 2014 23:17
JavaScript and Object Models

JavaScript and Object Models

A "choose your own adventure" story

JavaScript is has both object-oriented and functional heritage, thanks to its two parents: Scheme and Self.

It provides first class functions and makes it simple to compose these function objects into bundles of awesome. Even though I'm an OO "true believer" at heart, I find myself composing my code using functional concepts, and use the OO approach where there's a clear benefit or where I feel that it's the best way to communicate the interface.

Object-oriented software design is by no means the only way to do software design, but it's been an immensely successful model for a very long time now, and provides a clear and well-understood mental model for thinking and communicating about software. Lots of good ideas like encapsulation, delegation, traits and composition fit well into OO design.

@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) {
angular.module('d3AngularApp', ['d3'])
.directive('d3Bars', ['$window', '$timeout', 'd3Service',
function($window, $timeout, d3Service) {
return {
restrict: 'A',
scope: {
data: '=',
label: '@',
onClick: '&'
},
@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
@jpoehls
jpoehls / node-cluster-messaging.js
Created March 29, 2012 01:48
Simple message passing between cluster master and workers in Node.js
var cluster = require('cluster');
if (cluster.isWorker) {
console.log('Worker ' + process.pid + ' has started.');
// Send message to master process.
process.send({msgFromWorker: 'This is from worker ' + process.pid + '.'})
// Receive messages from the master process.