Skip to content

Instantly share code, notes, and snippets.

View tareq89's full-sized avatar

Muhammed Tareq Aziz tareq89

  • Dhaka, Bangladesh
View GitHub Profile
@tareq89
tareq89 / node-debug-chrome.sh
Last active July 2, 2024 11:47
This script lets you enable node server application in chrome inspect
#!/bin/bash
# Check if a port number is provided
if [ -z "$1" ]; then
echo -e "\033[31mUsage: $0 <port>\033[0m"
exit 1
fi
PORT=$1
@tareq89
tareq89 / cancelPromise.md
Created April 21, 2019 12:25 — forked from pygy/cancelPromise.md
You can already cancel ES6 Promises

The gist: by having a Promise adopt the state of a forever pending one, you can suspend its then handlers chain.

Promise.pending = Promise.race.bind(Promise, [])

let cancel

new Promise(function(fulfill, reject) {
  cancel = function() {fulfill(Promise.pending())}
  setTimeout(fulfill, 1000, 5)
@tareq89
tareq89 / Observer demo
Created February 6, 2019 04:52
Design pattern: Pub Sub vs Observers
Zafree = {
update = (param) => {
switch (param.type) {
case 'CALLING BELL':
// do something
case 'SHIHAN VAI CALLING':
// do something
case 'CARETAKER CALLING':
// do something
default:
@tareq89
tareq89 / README.md
Created February 8, 2018 16:43 — forked from addyosmani/README.md
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@tareq89
tareq89 / structure.md
Created December 22, 2017 11:15 — forked from sohelamin/structure.md
Node.js Application Structure
.
├── bin
│   ├── www
│   └── deploy.sh
├── config
│   ├── env
│   ├── index.js
│   └── passport.js
├── controllers
(function() {
'use strict';
angular
.module('app')
.directive('ncPlacesAutocomplete', NCPlacesAutocomplete);
/* @ngInject */
function NCPlacesAutocomplete() {
var directive = {
@tareq89
tareq89 / frontendDevlopmentBookmarks.md
Created November 5, 2016 05:51 — forked from dypsilon/frontendDevlopmentBookmarks.md
A badass list of frontend development resources I collected over time.
@tareq89
tareq89 / MongoDBMapReduceSurvival.txt
Created March 21, 2016 13:56
A list of MongoDB map reduce code to survive when in need!
1. To find out all the properties of documents in a Collection
mr = db.runCommand({
"mapreduce" : "my_collection",
"map" : function() {
for (var key in this) { emit(key, null); }
},
"reduce" : function(key, stuff) { return null; },
"out": "my_collection" + "_keys"
})
@tareq89
tareq89 / Google Map Coordinate + Address Collector
Last active March 13, 2016 05:54
Simple Map application, click on the map, it creates a marker and print the Geo Coordinate and address of that marker
<!DOCTYPE html>
<html>
<head>
<link type="javascript" href="https://code.jquery.com/jquery-2.1.4.min.js">
<style type="text/css">
html, body { height: 100%; margin: 0; padding: 0; }
#map { height: 80%; }
#latlongList { width: 80%; height: 60%; }
</style>
</head>
using System;
using System.Linq;
using System.Xml.Linq;
namespace selfPractise
{
class Program
{
static void Main ( string [ ] args )
{