Skip to content

Instantly share code, notes, and snippets.

Avatar

Santosh Kumar santosh

View GitHub Profile
@santosh
santosh / .gitconfig
Last active Oct 9, 2015
My .gitconfig file
View .gitconfig
[core]
editor = vii # See : http://unix.stackexchange.com/a/45877/22240
whitespace = nowarn
pager = less
diff = vimdiff
excludesfile = ~/.gitignore_global
[user]
name = # Santosh Kumar
email = # {Email Here}
[github]
@santosh
santosh / gist:3847486
Created Oct 7, 2012
JavaScript: Prevent email ID to be harvested by bots
View gist:3847486
// it will only work until harvester is a crawler
// "human" harvesters can't be prevented from this
//
// write your email address and put some extra weird
// characters in it, e.g. mymailNOSPAM@gmail.com
// now replace your weird characters with "nothing".
var link = document.getElementById('email');
link.href = link.href.replace(/NOSPAM/,'');
link.title = link.title.replace(/NOSPAM/,'');
@santosh
santosh / gist:3847513
Created Oct 7, 2012
JavaScript: Method #1: Randomize elements on a page
View gist:3847513
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width">
<title>Randomize Element</title>
<style type="text/css" media="screen">/* mininal style {{ */
html, body { height: 100%; overflow: hidden;}
@santosh
santosh / gist:3847532
Created Oct 7, 2012
JavaScript: Method #2: Randomize elements on a page
View gist:3847532
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width">
<title> Randomise Element's Position </title>
<style type="text/css" media="screen">
.randomizeme {
position:absolute;
@santosh
santosh / ChangeLink.html
Last active Dec 10, 2015
JavaScript: An example of changing link on the time when user clicks on it..
View ChangeLink.html
@santosh
santosh / ImageReflection.html
Created Jan 3, 2013
CSS: CSS technique to make image reflectionss
View ImageReflection.html
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" media="screen" href="reflection.css" />
<title> Image Reflection </title>
</head>
<body>
@santosh
santosh / downloadDirectlyToServer.php
Last active Dec 10, 2015
PHP: A PHP script to download files directly download files to webserver. This can help prevent your bandwidth of both end user and the webserver in situations like downloading WordPress to your computer then uploading to server. [Its just the case, WordPress like scripts are already included in some hosting plans ;)].
View downloadDirectlyToServer.php
<?php
/*
Please make sure that you already create a file that you are setting in $saveas variable,
and set its permission to 777 else you can receive an error telling you like permission
denied etc.
*/
// file to open and save to
$saveas = "capitalizr.py.zip";
@santosh
santosh / flickrScreen.html
Created Jan 7, 2013
JavaScript: Changes CSS value on a regular interval of time. This example will show how to change background color of body every 1 second
View flickrScreen.html
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> Random Color Generator in JavaScript </title>
<script type="text/javascript" charset="utf-8">
// generate random color
function colorname() {
@santosh
santosh / dencoder.html
Created Jan 11, 2013
JavaScript: URL dencoder is an URL encoder and decoder. The core is entirely written in JavaScript.
View dencoder.html
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width">
<title>URL Decoder/Encoder</title>
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
</head>
@santosh
santosh / getFullName.py
Created Feb 22, 2013
Get current user's (the user who runs the script) full name (UNIX), as in finger command.
View getFullName.py
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import os
import pwd
print(pwd.getpwuid(os.getuid())[4])