Skip to content

Instantly share code, notes, and snippets.

View rezwan-hossain's full-sized avatar

Rezwan Hossain rezwan-hossain

View GitHub Profile
@rezwan-hossain
rezwan-hossain / .babelrc
Created May 25, 2017 19:20 — forked from JamieMason/.babelrc
Tree-Shaking with Babel 6, Webpack 2, and React.
{
"presets": [
["es2015", {
"es2015": {
"loose": true,
"modules": false
}
}], "react"
]
}
@rezwan-hossain
rezwan-hossain / git_add_remove.txt
Last active August 3, 2017 10:51
Remove node_module form git add or git repo
git rm -r --cached node_modules
git commit -m ':) ;)'
git push origin master
@rezwan-hossain
rezwan-hossain / gist:431df2fba1d33cecc01bbf3ca8d80b24
Last active August 6, 2017 20:27
PostgreSQL and pgAdmin setup
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib
Switching Over to the postgres Account
The installation procedure created a user account called postgres that is associated with the default Postgres role.
In order to use Postgres, we can log into that account.
Switch over to the postgres account on your server by typing:
sudo -i -u postgres
You can now access a Postgres prompt immediately by typing:
@rezwan-hossain
rezwan-hossain / README.md
Created September 15, 2017 18:24 — forked from joyrexus/README.md
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@rezwan-hossain
rezwan-hossain / path.js
Created September 21, 2017 20:22 — forked from creationix/path.js
Simple path join and dirname functions for generic javascript
// Joins path segments. Preserves initial "/" and resolves ".." and "."
// Does not support using ".." to go above/outside the root.
// This means that join("foo", "../../bar") will not resolve to "../bar"
function join(/* path segments */) {
// Split the inputs into a list of path commands.
var parts = [];
for (var i = 0, l = arguments.length; i < l; i++) {
parts = parts.concat(arguments[i].split("/"));
}
// Interpret the path commands to get the new resolved path.
@rezwan-hossain
rezwan-hossain / index.html
Last active October 10, 2017 06:37
Render basic html file and folder in express
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<h1>hello World</h1>
// sending to sender-client only
socket.emit('message', "this is a test");
// sending to all clients, include sender
io.emit('message', "this is a test");
// sending to all clients except sender
socket.broadcast.emit('message', "this is a test");
// sending to all clients in 'game' room(channel) except sender
@rezwan-hossain
rezwan-hossain / gist:8f9dbabca6716ee09b8e474ecec0b818
Last active April 30, 2020 10:21
Shortcut to switch displays focus and cursor on ubuntu
install:
sudo apt install xdotool x11-xserver-utils or sudo apt-get install xdotool
usage: add to this keybord shortcut
To set focus to left screen pass "left" as arg
python3 ./focus_changer.py left
@rezwan-hossain
rezwan-hossain / Borders bookmarklet
Created November 7, 2020 03:35 — forked from ikenfin/Borders bookmarklet
Bookmarklet to show borders for divs
javascript:if(!window.__debug_div_borders_inited) { var sheet = document.styleSheets[0]; sheet.insertRule('body.__debug_div_borders div { outline: 1px solid green; }', ((sheet.cssRules && sheet.cssRules.length) || 0)); window.__debug_div_borders_inited = true; } document.body.classList.toggle('__debug_div_borders');void(0);
const redux = require("redux");
const createStore = redux.createStore;
const initialState = {
counter: 0,
};
//reducer
const reducer = (state = initialState, action) => {