Skip to content

Instantly share code, notes, and snippets.

View Sohail05's full-sized avatar

Sohail Aj. Sohail05

  • Canada
View GitHub Profile
@Sohail05
Sohail05 / MutationObserver.js
Created June 2, 2021 14:44
Hot Module Reload - Clear intervals
const observer = new MutationObserver((_m, _o) => {
const hmr = _m.some((m) => {
return m.attributeName === "data-hmr";
})
if (!hmr) {
return
}
//Remove previous Intervals & Timeouts
@Sohail05
Sohail05 / launch.json
Created May 30, 2020 16:32 — forked from cecilemuller/launch.json
Run ts-node in VSCode Debugger
{
"version": "0.2.0",
"configurations": [
{
"name": "Node Inspector",
"type": "node",
"request": "launch",
"args": ["${workspaceRoot}/src/service.ts"],
"runtimeArgs": ["-r", "ts-node/register"],
"cwd": "${workspaceRoot}",
@Sohail05
Sohail05 / consoleColors.js
Created April 4, 2020 21:18 — forked from abritinthebay/consoleColors.js
The various escape codes you can use to color output to StdOut from Node JS
// Colors reference
// You can use the following as so:
// console.log(colorCode, data);
// console.log(`${colorCode}some colorful text string${resetCode} rest of string in normal color`);
//
// ... and so on.
export const reset = "\x1b[0m"
export const bright = "\x1b[1m"
export const dim = "\x1b[2m"
@Sohail05
Sohail05 / form.html
Created May 24, 2018 21:04
Textbox to PHP Array
<form action="URL" method="POST">
<input type="text" name="myvalue"/>
<input type="submit" value="Submit form">
</form>
@Sohail05
Sohail05 / program.cs
Created April 30, 2018 02:46
Fibonacci
using System;
namespace Fibonacci
{
class MainClass
{
public static void Main (string[] args)
{
Console.WriteLine ("================");
Console.WriteLine ("Enter N Value");
"use strict";
console.log(list([{name: 'Bart'},{name: 'Lisa'},{name: 'Maggie'},{name: 'Homer'},{name: 'Marge'}]));
function list(names){
let string, nameArray;
nameArray = names.map( name => name.name );
string = nameArray.length > 1 ? " & " + nameArray.splice(nameArray.length-1) : "";
@Sohail05
Sohail05 / index.html
Created April 30, 2018 01:05
Atomic Design
<style media="screen">
.button{
background-color: rgba(0,100,200, 0.9);
color: white;
padding: 5px 10px;
border: none;
border-radius: 5px;
font-family: monospace;
}
@Sohail05
Sohail05 / letteravatar.js
Created March 9, 2018 09:39 — forked from vctrfrnndz/letteravatar.js
Generate SVG letter avatar
function drawCircle(text, size, color) {
var textSize = Math.ceil(size / 2.5);
var font = 'Proxima Nova, proxima-nova, HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif';
var colors = ["#1abc9c", "#16a085", "#f1c40f", "#f39c12", "#2ecc71", "#27ae60", "#e67e22", "#d35400", "#3498db", "#2980b9", "#e74c3c", "#c0392b", "#9b59b6", "#8e44ad", "#bdc3c7", "#34495e", "#2c3e50", "#95a5a6", "#7f8c8d", "#ec87bf", "#d870ad", "#f69785", "#9ba37e", "#b49255", "#b49255", "#a94136"];
var colorIndex = Math.floor((text.charCodeAt(0) - 65) % colors.length);
var finalColor = color || colors[colorIndex];
var template = [
'<svg height="' + size + '" width="' + size + '" style="background: ' + finalColor + '">',
'<text text-anchor="middle" x="50%" y="50%" dy="0.35em" fill="white" font-size="' + textSize + '" font-family="' + font + '">' + text.toUpperCase() + '</text>',
@Sohail05
Sohail05 / component.html
Created February 13, 2018 20:30
Web Component Design Pattern
<image-profile circle="true"></image-profile>
<image-profile></image-profile>
<image-profile></image-profile>
@Sohail05
Sohail05 / https2git.sh
Created August 7, 2017 07:41
Https to git protocal #git #config
#!/bin/bash
# ref: https://git-scm.com/docs/git-config
git config --global url."git://".insteadOf https://