Skip to content

Instantly share code, notes, and snippets.

View hemanth's full-sized avatar
🐜
🧘‍♂️

Hemanth HM hemanth

🐜
🧘‍♂️
View GitHub Profile
@hemanth
hemanth / reddit-filer.js
Created January 1, 2014 12:05
Filter out all the comments in a reddit post with less than 500 upvotes
votes = document.getElementsByClassName("score unvoted")
$.each(votes, function(i,l) {
var karma = parseInt(list.textContent);
if (karma < 500) {
list.parentElement.parentElement.style.cssText="display:none;"
}
});
@hemanth
hemanth / Gruntfile.js
Created December 31, 2013 14:13
grunt vs gulp
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: ';'
},
dist: {
src: ['src/**/*.js'],
dest: 'dist/<%= pkg.name %>.js'
@hemanth
hemanth / Immersive
Created December 24, 2013 13:39
Immersive mode apps for Android Kitkat
Badland
ComicRack
Comixology
Dayframe
Diceplayer
EVAC (and all other games by Hexage)
FBReader
Feedex
Google Play Books
Google Search
@hemanth
hemanth / devtool.bash
Created November 23, 2013 06:31
Hacking Chrome DevTools Setup
#!/usr/bin/env bash
# Setup script for hacking chrome devtools
# Source -> https://medium.com/p/8c8896f5cef3
echo "Creating folder and initialize a git repo"
mkdir devtools-frontend && cd devtools-frontend
git init
echo "Adding chromium remote and initialize sparse checkout"
git remote add upstream https://chromium.googlesource.com/chromium/blink
@hemanth
hemanth / Chrome_Features.md
Last active September 25, 2021 18:20
Current Chrome browser features.

img srcset => Enable a responsive images solution by providing the browser multiple resources in varying resolutions for a single image.

Arrow function => The arrow (=>) takes the place of the function keyword

Box Alignment => CSS properties for aligning boxes within their container. Allows for true vertical centering among other features.

DOM3 Keyboard Events => KeyboardEvent: keydown, keyup

Default parameter => Allows formal parameters to be initialized with default values if no value or 2 is passed.

@hemanth
hemanth / URL-API.md
Created August 6, 2013 15:31
WHATWG URL API

WHATWG URL API

script - unit tests - draft spec - See script for cross-browser quirks

var url = new URL(url, base);
var value = url.getParameter(name);
var valueArray = url.getParameterAll(name);
@hemanth
hemanth / nginx.conf
Created July 3, 2013 14:28
nginx redirections
rewrite ^/@$ https://twitter.com/:you permanent;
rewrite ^/~$ https://github.com/:you permanent;
rewrite ^/+$ https://plus.google.com/:you permanent;
rewrite ^/f$ https://www.facebook.com/:you permanent;
rewrite ^/in$ https://linkedin.com/in/:you permanent;
@hemanth
hemanth / which.py
Created June 14, 2013 06:03
Python which.
def which(program):
import os
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
fpath, fname = os.path.split(program)
if fpath:
if is_exe(program):
return program
else:
@hemanth
hemanth / async.py
Created June 14, 2013 05:58
Async process execution in python.
from subprocess import Popen, PIPE
from thread import start_new_thread
import os, distutils.spawn
def which(cmd):
path = distutils.spawn.find_executable(cmd)
if path == "None":
raise Exception("DepMissing")
else:
return path
@hemanth
hemanth / async.py
Created June 14, 2013 03:03
Async subprocess execution in python.
import sys
from subprocess import PIPE, Popen
from threading import Thread
try:
from Queue import Queue, Empty
except ImportError:
from queue import Queue, Empty # python 3.x
ON_POSIX = 'posix' in sys.builtin_module_names