Skip to content

Instantly share code, notes, and snippets.

View vishaltelangre's full-sized avatar

Vishal Telangre vishaltelangre

View GitHub Profile
base64 original_img.png | base64 --decode > ~/dest/decoded_image.png
@vishaltelangre
vishaltelangre / clearfix.css
Created February 3, 2014 08:34
css clearfix (IE6+)
/**
* CLEARFIX
*
* For modern browsers
* 1. The space content is one way to avoid an Opera bug when the
* contenteditable attribute is included anywhere else in the document.
* Otherwise it causes space to appear at the top and bottom of elements
* that are clearfixed.
* 2. The use of `table` rather than `block` is only necessary if using
* `:before` to contain the top-margins of child elements.
@vishaltelangre
vishaltelangre / demo.md
Last active August 29, 2015 13:56
jquery on example
@vishaltelangre
vishaltelangre / replace_every_char.jquery.js
Created April 8, 2014 12:21
Replace every character from a DOM node with desired character
function replaceEveryCharOf( selector, withChar, ignoreSpace ) {
$(selector).contents().filter(function() {
return this.nodeType == 3;
}).each(function(){
var regex = ignoreSpace ? /[^\s.]/g : /./g;
this.textContent = this.textContent.replace(regex, withChar);
});
}
// Usage:
@vishaltelangre
vishaltelangre / read_input.sh
Created April 9, 2014 20:02
Read user input #shell
echo "Do you think I am mad?"
read reply
echo $reply
@vishaltelangre
vishaltelangre / screenMatches.js
Last active August 29, 2015 13:59
responsive design helper function for javascirpt
/*
* Returns the different properties (Boolean) useful while responsive
* design.
*/
function screenMatches() {
var s = {};
if (window.matchMedia) {
/* Large desktop */
s.largeDesk = window.matchMedia("(min-width: 1200px)").matches;
/* Usual desktop */
@vishaltelangre
vishaltelangre / user.behaviors
Last active August 29, 2015 13:59
LightTable settings backup
;; User behaviors
;; -----------------------------
;; Behaviors are stored as a set of diffs that are merged together
;; to create the final set of functionality that makes up Light Table. You can
;; modify these diffs to either add or subtract functionality.
;;
;; Behaviors are added to tags, objects with those tags then automatically gain
;; whatever logic the behavior imparts. To see a list of user-level behaviors,
;; start typing a word related to the functionality you want in between the square
;; brackets (e.g. "theme").
@vishaltelangre
vishaltelangre / uthavdar.tmTheme
Last active August 29, 2015 13:59
Sublime Text color theme - Uthavdar (उठावदार) [inspired from solarized dark design] #uthavdar
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- @author Vishal Telangre -->
<!-- @copyright 2014 -->
<!-- @license MIT -->
<plist version="1.1">
<dict>
<key>name</key>
<string>Uthavdar</string>
<key>semanticClass</key>
@vishaltelangre
vishaltelangre / Makefile
Created May 15, 2014 05:58
go dependency management using vendor dir makefile
GO ?= go
GOPATH := $(CURDIR)/_vendor:$(GOPATH)
all: build
build:
$(GO) build
# reference: http://peter.bourgon.org/go-in-production/
@vishaltelangre
vishaltelangre / process_with_thread.rb
Last active August 29, 2015 14:01
Ruby demonstration for threading #ruby #thread
require 'thread'
def process(job)
puts "processing job #{job}\n"
sleep rand(3)
end
threads = []
for job in 1..10