Skip to content

Instantly share code, notes, and snippets.

View siddharthkrish's full-sized avatar

Siddharth Krish siddharthkrish

View GitHub Profile
@siddharthkrish
siddharthkrish / common.js
Created December 13, 2017 10:09
simple web page instrumentation
function notify( event ) {
$.post('https://requestb.in/1g52ujz1',
{ "button_name": $(this).attr('name'),
"position": $(this).attr('data-position') });
}
$(function(){
$( "button" ).on( "click", notify );
});
@siddharthkrish
siddharthkrish / version.sh
Created July 3, 2017 15:14
simple bash script to increment the version number of the format major.minor.build
#!/bin/bash
version="$1"
major=0
minor=0
build=0
# break down the version number into it's components
regex="([0-9]+).([0-9]+).([0-9]+)"
if [[ $version =~ $regex ]]; then
@siddharthkrish
siddharthkrish / config.js
Last active May 30, 2017 07:19
a possible way to define config variables for javascript
var CONFIG = (function() {
var private = {
'LANG': 'en_sg',
'HOPOFF_WAIT': '5'
};
return {
get: function(name) { return private[name]; }
};
})();
@siddharthkrish
siddharthkrish / index.html
Last active May 18, 2017 04:53
form input field that only accepts numbers
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript">
$( document ).ready( function () {
console.log("ready");
// check to see if an object with class .date has lost focussed. if so check
// the value of the input for the date type dd/mm/yyyy (only 1900-2099)
@siddharthkrish
siddharthkrish / cleanup.pl
Created June 10, 2015 15:01
rename folders & files of tv series to S00E00[.ext] format
#!/usr/bin/perl
use strict;
use warnings;
use File::Copy qw(move);
my $directory = '.';
opendir (DIR, $directory) or die $!;
while (my $file = readdir(DIR)) {