Skip to content

Instantly share code, notes, and snippets.

View saranyan's full-sized avatar

Saranyan saranyan

View GitHub Profile
@saranyan
saranyan / index.html
Created February 17, 2018 05:37 — forked from omimo/index.html
<html>
<head>
<title>
[Visualizing Movement Data with D3.js]
</title>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="https://omid.al/Mova-Viz/MovaViz-v0.1.2.js"></script>
<style>
* {
box-sizing: border-box
@saranyan
saranyan / dom-to-json.js
Created December 24, 2017 02:46 — forked from sstur/dom-to-json.js
Stringify DOM nodes using JSON (and revive again)
function toJSON(node) {
node = node || this;
var obj = {
nodeType: node.nodeType
};
if (node.tagName) {
obj.tagName = node.tagName.toLowerCase();
} else
if (node.nodeName) {
obj.nodeName = node.nodeName;
var base64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
// Global Crypto object
var Crypto = exports.Crypto = {};
// Crypto utilities
var util = Crypto.util = {
// Bit-wise rotate left
rotl: function (n, b) {
# install dependencies
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y cmake
sudo apt-get install -y libgtk2.0-dev
sudo apt-get install -y pkg-config
sudo apt-get install -y python-numpy python-dev
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install -y libjpeg-dev libpng-dev libtiff-dev libjasper-dev
@saranyan
saranyan / Grid-fs.js
Created April 25, 2016 00:12
Save file to Grid-fs
var conn = mongoose.connection;
var Grid = require('gridfs-stream');
Grid.mongo = mongoose.mongo;
//grid-fs
var gfs = Grid(conn.db);
//create a file by filename
app.post('/foo/file', auth, function(req, res) {
//so, this is a complete workaround to get a

Keybase proof

I hereby claim:

  • I am saranyan on github.
  • I am saranyan (https://keybase.io/saranyan) on keybase.
  • I have a public key whose fingerprint is 51E0 7B3A 9317 6503 722C 2648 8D6B 045B ECCC C1B5

To claim this, I am signing this object:

@saranyan
saranyan / crusts.csv
Created January 14, 2014 19:25
Bigcommerce options tutorial (Pizza store)
thin http://bevcooks.com/wp-content/uploads/2011/12/pizza9.jpg 0
hand stuffed http://cdn.foodbeast.com.s3.amazonaws.com/content/uploads/2013/10/3-cheese-closeup.jpg 0
regular http://blogs.babble.com/family-kitchen/files/2010/10/Stuffed-Crust-Pizza.jpg 0
@saranyan
saranyan / category_level_watermark.js
Created August 21, 2013 03:20
Category level "soldout" watermark for Bigcommerce products
function doCheck(i,links){
$.get(links[i],function(data){
if($(data).find('.ProductMain').find('.OutOfStockMessage').html().length > 10)
{
//console.log("true");
var img = $('.ProductImage.QuickView a img').eq(i);
var top = img.position.top;
var left = img.position.left;
$('<img id="overlay'+i+'" src="' + window.location.origin + '/product_images/uploaded_images/soldout.png" />').insertBefore(img);
$("#overlay"+i).css({"position":"absolute","top":top,"left":left,"height":"100px","width":"100px"});
@saranyan
saranyan / product_data.csv
Last active December 21, 2015 07:49
Update product min_quantity and max_quantity from CSV file using Bigcommerce API
id order_quantity_min order_quantity_max
32 2 10
33 2 10
34 2 10
@saranyan
saranyan / watermark.js
Last active December 21, 2015 07:19
Bigcommerce - add soldout watermark to product thumbnail. Ideally paste this code in a script tag in the Footer template.
if($('.ProductMain').find('.OutOfStockMessage').html().length > 10)
{
$('.ProductThumbImage a img').attr('id','watermark');
var top = $('.ProductThumbImage a img').position.top;
var left = $('.ProductThumbImage a img').position.left;
$('<img id="overlay" src="' + window.location.origin + '/product_images/uploaded_images/soldout.png" />').insertBefore(".ProductThumbImage a > img:first");
$("#overlay").css({"position":"absolute","top":top,"left":left,"height":"100px","width":"100px"});
}