Skip to content

Instantly share code, notes, and snippets.

View santosh's full-sized avatar
:octocat:

Santosh Kumar santosh

:octocat:
View GitHub Profile
@santosh
santosh / website_optimization.md
Last active October 15, 2020 15:50
Before pushing a site into production, double check these points.

This is an incomplete list:

  • Make spritesheet of all images.
  • Use CDN for static websites
  • Use Audit tools (Chrome)
  • Google PageSpeed
    • Minify the CSS and JavaScript you are using
    • Reduce the HTTP request
    • Optimize the images as much possible
@santosh
santosh / time_localStorage.html
Last active August 29, 2015 14:27
Put time in localstorage if user visits for first time and retrieve later when the webpage was visited.
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta charset="utf-8" />
<title> Loopingtriangle </title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width,initial-scale=1.0"/>
</head>
<body>
<script charset="utf-8">
@santosh
santosh / pythonProjectTODO.md
Created August 18, 2015 20:43
Take care of these things in a Python based project.

Development Phase

  • PEP-0008
  • Follow the hierarchy by distribute module
  • Implement argparse if it's a command line program

Publicity Phase

  • Post it on comp.lang.python with some masala
  • obviously on social networking sites, specially Geeklist, Reddit
  • Choose appropriate audience for app
@santosh
santosh / default.conf
Created November 15, 2015 08:20
My Code::Blocks configuration file. Including the 5 color schemes.
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocksConfig version="1">
<!-- application info:
svn_revision: 9501
build_date: Dec 10 2013, 22:28:10
gcc_version: 4.7.1
Windows Unicode -->
<app>
<locale>
<CATALOGNUM int="61" />
@santosh
santosh / .vimrc
Created November 16, 2015 13:53
Minimal .vimrc file for Windows. Note that my dotfiles are on BitBucket. For sake of compatibility I am maintaining a different version for Windows.
" {{
se nocompatible autoindent autoread autowrite autowriteall confirm cindent expandtab foldenable gdefault hidden hlsearch ignorecase incsearch lazyredraw lbr nu ruler sm sc smd scs smartindent sta spell splitright ttyfast undofile noerrorbells wildmenu wrap equalalways splitbelow wrapscan list
" }}
se dir=~/tmp/vimswapfiles//,~/.vim/vimswapfiles// bs=eol,start,indent,start cb=unnamed cc=-1 cot=menu,longest,preview enc=utf-8 ffs=unix fdm=marker foldlevel=0 fmr={{,}} foldopen=block,hor,insert,jump,mark,percent,quickfix,search,tag,undo formatoptions=tcqrn1 history=100 laststatus=2 matchtime=1 mouse=a nrformats=octal,hex,alpha scrolloff=5 shiftwidth=4 softtabstop=4 spl=en_us timeoutlen=300 tw=77 ts=4 undolevels=1000 udir=~/tmp/vimundo,~/.vim/vimundo uc=10 whichwrap+=<,>,[,],h,l wildchar=<tab> wig=*.o,*.obj,*.bak,*.exe,*.py[co],*.swp,*~,*.pyc,.svn guioptions-=T lcs=tab:?\ ,eol:¬,trail:·,nbsp:?
" ESSENTIALS
" ==========
" {{
filetype plugin indent on
let snips_author = 'Santosh Kumar'
@santosh
santosh / bottom-flex-belt.html
Last active October 8, 2016 03:36
Bottom flex belt, as was done in ajneffects.com inspired from redgiant.com, but later replaced with something better. Pen here for future reference if ever needed to make one.
<!DOCTYPE html>
<html>
<head>
<title> Practicing </title>
<link href="https://fonts.googleapis.com/css?family=Josefin+Sans" rel="stylesheet">
</head>
<style type="text/css">
.thumbnail-grid {
user-select: none
@santosh
santosh / functions.php
Created December 10, 2016 09:30
Add these line of codes to functions.php of your theme; to display thumbnail of featured image of the post. #WordPress
/*===================
ADD IMAGE TO FEED
===================*/
// display featured post thumbnails in RSS feeds
function WPGood_rss_thumbs( $content ) {
global $post;
if( has_post_thumbnail( $post->ID ) ) {
$content = '<figure>' . get_the_post_thumbnail( $post->ID, 'large' ) . '</figure>' . $content;
}
@santosh
santosh / arrayMinimum.js
Last active December 27, 2016 10:00
Find the minimum number in an array. #JavaScript
function arrayMinimum(inputArray) {
var indexOfMinimum = 0;
for (var i = 1; i < inputArray.length; i++) {
if (inputArray[i] < inputArray[indexOfMinimum]) {
indexOfMinimum = i;
}
}
return inputArray[indexOfMinimum] ;
}
@santosh
santosh / sumOfDigits.js
Created December 27, 2016 10:02
Calculate sum of digits in a number. e,g, 1234 = 10. #JavaScript
function digitSum(n) {
n = parseInt(n).toString()
var sum = 0;
for (var i = 0; i < n.length; i++) {
sum += parseInt(n[i]);
}
return sum;
}
@santosh
santosh / senduseragent.py
Created November 2, 2017 07:12
Return back user agent in Flask. #Python
from flask import Flask, request
app = Flask(__name__)
@app.route('/')
def index():
user_agent = request.headers.get('User-Agent')
return '<p>Your browser is {}!</p>'.format(user_agent)
@app.route('/user/<name>')
def user(name):