Skip to content

Instantly share code, notes, and snippets.

View krrishd's full-sized avatar
🤯

Krish Dholakiya krrishd

🤯
View GitHub Profile
@krrishd
krrishd / backtogeocities.js
Last active April 19, 2016 19:43
Bootstrap To Geocities
/*
Tired of the same old bootstrapped site?
Miss the trendy, hip Geocities look?
This bookmarklet will fix that in a click!
Derived from Bootstrap Geocities theme at http://code.divshot.com/geo-bootstrap/
Simply add new bookmark, edit url, and add bottom code in place of url. Whenevver you miss Geocities, click it.
*/
@krrishd
krrishd / sub.js
Created November 8, 2013 15:58 — forked from jiaaro/sub.js
function replace(txt) {
txt = txt.replace(/witnesses/gi, "dudes I know");
txt = txt.replace(/allegedly/gi, "kinda probably");
txt = txt.replace(/new study/gi, "tumblr post");
txt = txt.replace(/rebuild/gi, "avenge");
txt = txt.replace(/space/gi, "spaaace");
txt = txt.replace(/google glass/gi, "virtual boy");
txt = txt.replace(/smartphone/gi, "pokédex");
txt = txt.replace(/electric/gi, "atomic");
txt = txt.replace(/senator/gi, "elf-lord");
@krrishd
krrishd / asyncLs
Created January 11, 2014 04:57 — forked from nstadigs/asyncLs
(function(exports) {
var mod = function (databaseName, saveInterval) {
var self;
saveInterval = saveInterval || 2000;
databaseName = databaseName || 'unnamed';
this.hasChanged = false;
this.store = {};
# Assume connections are sorted by date
# Calculate score at each month in time since the year 2005.
# This means you have (2014-2005) * 12 + 1 = 109 months of data
# Assume connection array is your sorted list of connections by date
# This creates an array where the value of the index is corresponds to the number of months
# that has passed since Jan. 2005 (arbitrary date, not much social data before then)
# Algorithm is upper-bounded by O(i+j), but average runtime will be more like O(max(i, j))
var i = 0; # Keeps track of number of months that has passed since Jan. 2005
for (i = 1; i < ($scope.locations.length); i++) {
var connMarker = L.marker([$scope.locations[i].latitude, $scope.locations[i].longitude]).addTo(map).addEventListener("click", function(e) {
var item;
var connection;
for(b = 0; b < $scope.locations.length; b++) {
item = $scope.data.identity_connections[b];
if (item.location_id == $scope.locations[i].id) {
connection = item;
console.log(connection);
break;
@krrishd
krrishd / keybase.md
Created March 28, 2014 22:23
Keybase Verification

Keybase proof

I hereby claim:

  • I am krrishd on github.
  • I am krrishd (https://keybase.io/krrishd) on keybase.
  • I have a public key whose fingerprint is 9BBF 10C1 0D9C 89AD C0CA 7062 8936 5571 C6F8 2966

To claim this, I am signing this object:

-----BEGIN PGP MESSAGE-----
Version: Keybase OpenPGP v0.1.1
Comment: https://keybase.io/crypto
wcFMA7Bm20dxr6FUARAAjlfHIUZ1SBwj08OJgYocIetmxzHMkqhmg2rOyVRGihQD
B+r6TgY2sfFE94LUYuJsgyDKHdol99wiuw4X/mKsaOZOomQNy2bA/cwfPjvLQBbH
twkhFQDHmcF7C4BfW7/uVGyPblqy+rgyozR5kRzMf1lajuxCrPTikueJ7dBjSpfi
4rP24SAn6cR5z1nxNHw82Q6uKnUlg6TfKW3Cn1nOAAs/nn4ohDDxSoGXgNQ2r6pM
MFgfHerYm7jRR1FTRkQdPJrWStrsqHU0NiHerTrqFCNbRKvuhsnr8QCTiAqfjeTR
cZy96HDmXhk/E2n8rK66o2x5YC2lb4bL/s622lPQ9iOrXd/aQ2FYgBB79BjmVfA4
@krrishd
krrishd / consoleSwag.js
Last active August 29, 2015 14:00
console.swag - a small library to help style your console outputs with css properties
console.swag = function(item, style) {
var cStyle =
"line-height: " + "35px; " +
"padding: " + "10px; " +
"border-radius: " + "3px; " +
"background-color: " + (style.bg || "rgba(0,0,0,.8)") + "; " +
"color: " + (style.color || "white") + "; " +
"font-size: " + (style.fSize || "1.2em") + "; " +
"font: " + (style.font || "sans-serif") + "; " +
"text-shadow: " + "1px 1px 3px " + (style.tShadow || "rgba(0,0,0,1)");
@krrishd
krrishd / rss2json.js
Last active November 24, 2017 08:56
rss2json
/*
* Example Usage:
*
* $.get('http://cors.io/sprunge.us/ILRc', function(data) {
* window.xmlData = data;
* window.domParser = new DOMParser();
* window.parsedXML = domParser.parseFromString(window.xmlData, 'text/xml');
* window.jsonFeed = rss2json(parsedXML);
* });
*
@krrishd
krrishd / stringReverse.js
Created June 20, 2014 00:29
String.prototype.reverse() - A random snippet I made in the console
String.prototype.reverse = function() {
var reversed = [];
for(i=0; i< this.length; i++) {
reversed[this.length - i] = this[i];
}
var rev_str = "";
for(e=0;e<reversed.length;e++) {
rev_str += reversed[e];
}
rev_str = rev_str.replace('undefined', '');