Skip to content

Instantly share code, notes, and snippets.

View mahidaparth7's full-sized avatar

Parth Mahida mahidaparth7

  • Surat,India
View GitHub Profile
@mahidaparth7
mahidaparth7 / nodejs-tcp-example.js
Created December 3, 2019 08:08 — forked from tedmiston/nodejs-tcp-example.js
Node.js TCP client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
@mahidaparth7
mahidaparth7 / graphicsmagick.sh
Created March 18, 2019 04:05 — forked from witooh/graphicsmagick.sh
Install Graphicsmagick
sudo apt-get install python-software-properties
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:rwky/graphicsmagick
sudo apt-get update
sudo apt-get install graphicsmagick
@mahidaparth7
mahidaparth7 / using-raw-socket-io-in-sails.js
Created October 8, 2018 03:53 — forked from mikermcneil/using-raw-socket-io-in-sails.js
Using raw socket.io functionality in a Sails.js controller
module.exports = {
/**
*
* Using raw socket.io functionality from a Sails.js controller
*
*/
index: function (req,res) {
@mahidaparth7
mahidaparth7 / app-1.spec.ts
Created September 29, 2017 04:37 — forked from wkwiatek/app-1.spec.ts
Angular 2 test snippets for Angular final version. Codebase for https://developers.livechatinc.com/blog/category/programming/angular-2/
// App
import { Component } from '@angular/core';
@Component({
selector: 'app',
template: '<span>{{ sayHello() }}</span>',
})
export class App {
public name: string = 'John';
@mahidaparth7
mahidaparth7 / readme.md
Created April 9, 2017 06:57 — forked from coolaj86/how-to-publish-to-npm.md
How to publish packages to NPM

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "[email protected]"
npm set init.author.url "http://yourblog.com"

npm adduser

@mahidaparth7
mahidaparth7 / memorySizeOfObject.js
Created March 29, 2017 09:31
calculate memory size of javascript object, it is not a accurate value!
function memorySizeOf(obj) {
var bytes = 0;
function sizeOf(obj) {
if(obj !== null && obj !== undefined) {
switch(typeof obj) {
case 'number':
bytes += 8;
break;
case 'string':
@mahidaparth7
mahidaparth7 / webhook-mailer.php
Created December 29, 2016 11:22 — forked from boucher/webhook-mailer.php
Stripe Webhook PHP Example
<?php
// SETUP:
// 1. Customize all the settings (stripe api key, email settings, email text)
// 2. Put this code somewhere where it's accessible by a URL on your server.
// 3. Add the URL of that location to the settings at https://manage.stripe.com/#account/webhooks
// 4. Have fun!
// set your secret key: remember to change this to your live secret key in production
// see your keys here https://manage.stripe.com/account
@mahidaparth7
mahidaparth7 / index.js
Created December 29, 2016 11:05 — forked from nicodinh/index.js
es6 classes final semantics
// http://www.2ality.com/2015/02/es6-classes-final.html
const chalk = require('chalk');
class Point {
constructor(x, y) {
this.x = x;
this.y = y;
}
@mahidaparth7
mahidaparth7 / app.js
Created December 29, 2016 11:03 — forked from ashiq-r31/app.js
var express = require('express');
var favicon = require('serve-favicon');
var app = express();
app.use(favicon(__dirname + '/public/images/favicon.ico'));
var path = require('path');
var router = express.Router();
var request = require('request');
var exphbs = require('express-handlebars');