Skip to content

Instantly share code, notes, and snippets.

@sp2hari
sp2hari / domaintracker.js
Created Dec 3, 2022
Domain Tracker in Google Sheets
View domaintracker.js
const DEBUG_MODE = true;
const MAX_ROWS = 30;
function onOpen() {
SpreadsheetApp
.getUi()
.createMenu('Tracker')
.addItem('Update Domain Data', 'updateAllDomainData')
.addToUi()
}
View splash.html
<!doctype html>
<html>
<head>
<style class="cp-pen-styles">#featureAnimation,#featureBox{background-color:#fff;overflow:hidden;line-height:normal;font-size:80%;z-index:1000;}#featureAnimation{position:fixed;visibility:hidden;}#featureBox{position:absolute;}.star{position:absolute;background-color:#161616;display:none;z-index:1001;}.dot{position:absolute;background-color:#91e600;}.page-box{opacity:0;}</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/gsap/1.11.2/TweenMax.min.js'></script></head>
<body id="home" class="fixed-header">
<div id="featureBox"></div><div class="feature" id="featureAnimation"><div id="featureBackground" style="pointer-events:none;"></div></div>
<script type="text/javascript">
/* verge 1.9.1+201402130803 | https://github.com/ryanve/verge | * MIT License 2013 Ryan Van Etten | Script to fetch viewport dimensions */
View bookshelf.html
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
jQuery(document).ready(function(){
jQuery(".book-wrap").mouseenter(function(){
jQuery(this).addClass("rotate");
});
jQuery(".book-wrap").mouseleave(function(){
jQuery(this).removeClass("rotate");
});
@sp2hari
sp2hari / unPause.gs
Created Jul 3, 2020
Google Script for Inbox Pause
View unPause.gs
function unPause() {
var pausedLabel = GmailApp.getUserLabelByName("Inbox-Paused");
if (pausedLabel) {
var threads = pausedLabel.getThreads();
for (var i = 0; i < threads.length; i++) {
threads[i].moveToInbox();
pausedLabel.removeFromThread(threads[i]);
}
}
@sp2hari
sp2hari / Code.gs
Created Jun 13, 2020
Mail Merge to PDF Files - v2
View Code.gs
/*
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
@sp2hari
sp2hari / script.js
Last active May 8, 2020
Mail Merge to PDF Files
View script.js
/*
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
@sp2hari
sp2hari / install_all_firefox.sh
Created Aug 14, 2015
Script to download/install all firefox versions
View install_all_firefox.sh
#!/bin/bash
default_versions_future="beta aurora nightly ux"
default_versions_current="39"
default_versions_past="2 3 3.5 3.6 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38"
versions_usage_point_one="3.6 12 16 17 22 23 25"
versions_usage_point_two="21 24 26"
versions_usage_point_three=""
versions_usage_point_four_up="27 28 29"
@sp2hari
sp2hari / app.js
Last active Aug 29, 2015
Nodejs custom log
View app.js
app.use(express.logger(function(tokens, req, res) {
return '{"request_method" : "'+req.method+'", "url" : "'+req.url+'", "user_agent" : "'+req.headers['user-agent']+'", "duration" : "'+String((Date.now() - req._startTime)/1000)+'", "namespace" : "autocomplete", "response_status" : "'+(res.headerSent ? res.statusCode : null)+'", "timestamp": "'+new Date().toUTCString()+'", "remote_ip": "'+req.ip+'", "request_uid" : "'+req.headers["X-Request-Unique-Id"]+'", "start_time" : "'+req._startTime+'", "end_time" : "'+new Date().toUTCString()+'" }'
}));
@sp2hari
sp2hari / errorception.js
Created Sep 20, 2014
Close all errors from errorception project
View errorception.js
setInterval (function() {
document.getElementById("selectAll").click(); document.getElementById("statusClose").click(); }
, 5000);
@sp2hari
sp2hari / run1.cc
Created May 8, 2012
Code snippets for Interviewstreet Sample Test
View run1.cc
/* This is the correct working solution */
#include <iostream>
using namespace std;
int main() {
int n, sum = 0;
cin >> n;
for (int i=0; i<=n; i++) {
sum += i;
}
cout << sum << endl;