Skip to content

Instantly share code, notes, and snippets.

Kumar Chetan Sharma kumarldh

Block or report user

Report or block kumarldh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kumarldh
kumarldh / bashrc
Last active Mar 1, 2017
Some shortcuts I need in basrc
View bashrc
command_exists () {
type "$1" &> /dev/null ;
}
# grep always with color and line number
alias grep='grep -n --color=always'
# git
if command_exists git ; then
alias gitco='git checkout'
View virtual-host
<VirtualHost *:80>
#webmaster's email address
ServerAdmin webmaster@localhost
ServerName my-virtual-host
DocumentRoot /var/www/my-virtual-host/document/root/
<Directory />
Options FollowSymLinks
#Comment following to enable oveririding through .htaccess, e.g. mod_rewrite
AllowOverride None
</Directory>
@kumarldh
kumarldh / timer-setimeout.html
Created May 25, 2014
An example for module pattern.
View timer-setimeout.html
<html>
<head>
<title>timer using setTimeout</title>
</head>
<body>
<script>
var timer = function () {
var i = 0;
return function () {
i = i + 1;
@kumarldh
kumarldh / gist:669ec77a5263be54b06a
Created May 23, 2014
Check if a given number is power of 2. This can be modified any number less than 10.
View gist:669ec77a5263be54b06a
<!DOCTYPE html>
<html>
<head>
<title>Check if a given a number is power of 2</title>
<meta charset="UTF-8">
</head>
<body>
Check if a given number is power of 2. This can be modified any number less than 10.
<script>
function isPowerOf2(input){
View gist:26f3feaa56068939f50c
<!DOCTYPE html>
<html>
<head>
<title>Given a number count trailing zeros!</title>
<meta charset="UTF-8">
</head>
<body>
This is different from counting trailing zeroes from a given factorial.
<script>
function countTrailingZeros(input){
View hydra-head-vanilla-js.html
<!DOCTYPE html>
<html>
<head>
<title>Hydra - Delete one button & produce two more!</title>
<meta charset="UTF-8">
</head>
<body id="hydrabody">
<button class="hydrahead">Hydra Head</button>
</body>
<script>
@kumarldh
kumarldh / mythical-hydra-as-buttons.html
Created Mar 16, 2014
When you cut down a head of Hydra, another two heads appear. A button is a head.
View mythical-hydra-as-buttons.html
<!DOCTYPE html>
<html>
<head>
<title>Hydra - Delete one button & produce two more!</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body id="hydrabody">
<button class="hydrahead">Hydra Head</button>
</body>
View flexi-list.html
<html>
<head>
<title>Flexi list</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<style>
#container{
padding: 3px;
color: #000;
font-family: sans-serif;
@kumarldh
kumarldh / find-non-secure-assest.js
Created Jan 17, 2014
loads a page and checks for non secure items.
View find-non-secure-assest.js
var request = require('request');
var cheerio = require('cheerio');
var url = require('url');
var httpsurl = 'https://www.yahoo.com/';
var assets = {
img: {src:'src'},
link: {src:'href'},
script: {src:'src'}
};
You can’t perform that action at this time.