Skip to content

Instantly share code, notes, and snippets.

View vinitkumar's full-sized avatar
Focusing

Vinit Kumar vinitkumar

Focusing
View GitHub Profile
@marcoslhc
marcoslhc / gist:4158366
Last active August 2, 2016 21:08
Create a git managed website in webfaction
# based in the joe maller method of
# managing a live website through
# git:
#
# http://joemaller.com/990/a-web-focused-git-workflow/
#
#!/bin/bash
print_help(){
" antirez's .vimrc
" Copyright(C) 2001 Salvatore Sanfilippo
" Enable the syntax highlight mode if available
syntax sync fromstart
if has("syntax")
syntax sync fromstart
syntax on
set background=dark
let php_sync_method="0"
@granoeste
granoeste / MainActivity.java
Created August 8, 2012 03:06
[Android] Button background change for state. (selector)
package com.example.sellectorsample;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends Activity implements OnClickListener {
@jboner
jboner / latency.txt
Last active April 29, 2025 15:40
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@paulsmith
paulsmith / verbatim_templatetag.py
Created October 25, 2011 19:03 — forked from ericflo/verbatim_templatetag.py
verbatim Django template tag
"""
jQuery templates use constructs like:
{{if condition}} print something{{/if}}
This, of course, completely screws up Django templates,
because Django thinks {{ and }} mean something.
Wrap {% verbatim %} and {% endverbatim %} around those
blocks of jQuery templates and this will try its best
@mohamedmansour
mohamedmansour / background.html
Created June 30, 2011 00:14
Local Storage Message Passing Chrome Extension
<!doctype html>
<script>
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.sendRequest(tab.id, {method: "getLocalStorage"}, function(response) {
var myObjectRetrieved = JSON.parse(response.data);
console.log(myObjectRetrieved);
});
});
// Automatically inject all pages with the content script when the extension
@trevmex
trevmex / bst.js
Created February 11, 2011 05:38
A simple binary search tree in JavaScript
/*
* File: bst.js
*
* A pure JavaScript implementation of a binary search tree.
*
*/
/*
* Class: BST
*