Skip to content

Instantly share code, notes, and snippets.

Avatar

Saranyan saranyan

View GitHub Profile
View 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 Dec 24, 2017 — forked from sstur/dom-to-json.js
Stringify DOM nodes using JSON (and revive again)
View dom-to-json.js
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;
View crypto.js
var base64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
// Global Crypto object
var Crypto = exports.Crypto = {};
// Crypto utilities
var util = Crypto.util = {
// Bit-wise rotate left
rotl: function (n, b) {
View install-opencv-2.4.11-in-ubuntu.sh
# 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 Apr 25, 2016
Save file to Grid-fs
View Grid-fs.js
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
View keybase.md

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 Jan 14, 2014
Bigcommerce options tutorial (Pizza store)
View crusts.csv
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 Aug 21, 2013
Category level "soldout" watermark for Bigcommerce products
View category_level_watermark.js
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 Dec 21, 2015
Update product min_quantity and max_quantity from CSV file using Bigcommerce API
View product_data.csv
id order_quantity_min order_quantity_max
32 2 10
33 2 10
34 2 10
@saranyan
saranyan / watermark.js
Last active Dec 21, 2015
Bigcommerce - add soldout watermark to product thumbnail. Ideally paste this code in a script tag in the Footer template.
View watermark.js
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"});
}