Skip to content

Instantly share code, notes, and snippets.

View sudkumar's full-sized avatar
🏠
Working from home

Sudhir Mitharwal sudkumar

🏠
Working from home
View GitHub Profile
@sudkumar
sudkumar / channels.tsx
Last active September 1, 2024 08:45
Web-Sockets in ReactJS with PusherJs and Laravel Echo with public and private channels
import React, { useEffect, useState, useMemo } from "react"
import Echo from "laravel-echo"
import Pusher from "pusher-js"
/**
* Pusher configuration
*/
const pusherConfig = {
key: '<your_pusher_key_here>',
cluster: '<pusher_cluster>',
@sudkumar
sudkumar / frontmatter.js
Last active November 3, 2024 17:56
MDX Remark plugin to handle frontmatter
// helps us in parsing the frontmatter from text content
const matter = require('gray-matter')
// helps us safely stringigy the frontmatter as a json object
const stringifyObject = require('stringify-object')
// helps us in getting the reading time for a given text
const readingTime = require('reading-time')
// please make sure you have installed these dependencies
// before proceeding further, or remove the require statements
// that you don't use
@sudkumar
sudkumar / # neovim - 2018-10-17_20-42-08.txt
Created October 17, 2018 15:13
neovim on macOS 10.14 - Homebrew build logs
Homebrew build logs for neovim on macOS 10.14
Build date: 2018-10-17 20:42:08
@sudkumar
sudkumar / install_tmux_locally.sh
Last active June 9, 2023 06:38
How to install tmux locally
#!/bin/bash
# Installing tmux locally
# 1. visit: https://github.com/tmux/tmux
# 2. create a local directory to install tmux
# 3. download depencencies
# 1. libevent
# 1. visit: http://libevent.org/
# 2. download the stable version
# 2. ncurses
# import the required stuff
import urllib2
import lxml.html
import urlparse
pdfLinks = []
def getContentType(connection):
meta = connection.info()
return meta.getheader("Content-Type")
@sudkumar
sudkumar / regex.md
Last active January 21, 2023 16:28

Regular Expression

Regular expression are used to match a string or a set of string

General format

/matching_pattern/flags
  • matching_pattern: Any pattern to match with a string