Skip to content

Instantly share code, notes, and snippets.

View MKRhere's full-sized avatar
😕
In a mid-youth crisis

Muthu Kumar MKRhere

😕
In a mid-youth crisis
View GitHub Profile
@MKRhere
MKRhere / meta-tags.md
Last active June 3, 2020 11:31 — forked from kevinSuttle/meta-tags.md
List of Usable HTML Meta and Link Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
@MKRhere
MKRhere / build.js
Last active December 8, 2017 16:10
Node Build and Watch Script for static websites using sass, js (no Webpack necessary)
/*
// Add these to package.json and do `npm install --only=dev`
// Add this file to project root, and then do `node build`
"devDependencies": {
"@babel/core": "^7.0.0-beta.34",
"@babel/preset-env": "^7.0.0-beta.34",
"babel-cli": "^6.26.0",
"babelify": "^8.0.0",
"browserify": "^14.5.0",
@MKRhere
MKRhere / default.conf
Last active April 6, 2018 07:45
nginx default config file
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
@MKRhere
MKRhere / grub-install
Created February 16, 2018 20:24
Grub Install
$ sudo mount /dev/sda# /mnt
$ sudo mount /dev/sda# /mnt/boot
$ sudo grub-install --root-directory=/mnt /dev/sda
@MKRhere
MKRhere / test.fail.js
Created March 14, 2018 09:52
The mess that is ASI
const myVar = [5, 6, 7]
[ 1, 2, 3 ].forEach(x => console.log(x))
console.log(myVar)
@MKRhere
MKRhere / html-prettifier.js
Created May 2, 2018 10:21
HTML Prettifier
// Original: https://jsfiddle.net/buksy/rxucg1gd/
// Parameters:
// code - (string) code you wish to format
// stripWhiteSpaces - (boolean) do you wish to remove multiple whitespaces coming after each other?
// stripEmptyLines - (boolean) do you wish to remove empty lines?
var formatCode = function(code, stripWhiteSpaces, stripEmptyLines) {
"use strict";
var whitespace = ' '.repeat(4); // Default indenting 4 whitespaces
var currentIndent = 0;
var char = null;
@MKRhere
MKRhere / git-ignore
Last active May 3, 2018 15:44 — forked from wojpawlik/git-ignore
Easily add files to .gitignore from shell. Just put it in a directory in your PATH and chmod +x git-ignore
#!/usr/bin/env bash
if [ -d "./.git" ]; then
for i in "$@"; do
echo $i
done >> .gitignore
else
echo "Not a git repository"
fi
@MKRhere
MKRhere / gitea.sh
Last active June 25, 2018 10:18
Gitea installation script
# My Dependencies: systemd to daemonise process, nginx as reverse proxy
latest=$(curl -sL https://api.github.com/repos/go-gitea/gitea/releases | awk '/"name":/ { print $2; exit; }')
latest=${latest//[\"v,]/}
curl -sL https://dl.gitea.io/gitea/$latest/gitea-$latest-linux-amd64 -o gitea
chmod +x gitea
sudo useradd -m git
sudo mkdir /home/git/gitea
sudo mv gitea /home/git/gitea/
sudo chown -R git:git /home/git/gitea
@MKRhere
MKRhere / ArrayLike.js
Last active June 7, 2018 16:59
Array-like custom class in JavaScript
class ArrayLike {
constructor (...items) {
if(items.length === 1 && !isNaN(items[0]))
for(let i = 0; i < items[0]; i++) {
this[i] = undefined;
}
else items.forEach((item, index) => this[index] = item);
return new Proxy(this, {
get: (obj, key) => {
if(key in obj) return obj[key];
@MKRhere
MKRhere / utils.js
Last active June 28, 2018 13:44
Random JavaScript utils
// Object map
function mapobjIndexed (fn, obj) {
const curriedMapobjIndexed = obj => Object.keys(obj).reduce((acc, cur) => ({...acc, [cur] : fn(obj[cur], cur, obj) }), {})
if(arguments.length < 2) return curriedMapobjIndexed;
return curriedMapobjIndexed(obj);
}
// Prototype version
Object.prototype.map = function (fn) {
return Object.keys(this).reduce(