Skip to content

Instantly share code, notes, and snippets.

View saranyan's full-sized avatar

Saranyan saranyan

View GitHub Profile
@saranyan
saranyan / README.md
Created July 24, 2012 19:38 — forked from chrisjacob/README.md
How to: GitHub Pages "gh-pages" branch for User & Organization Pages

GitHub Pages "Normal" Setup for User & Organization Pages

Let’s say your GitHub username is “alice”. If you create a GitHub repository named alice.github.com, commit a file named index.html into the master branch, and push it to GitHub, then this file will be automatically published to http://alice.github.com/... The same works for organizations.

Read more here: http://pages.github.com/

However... the downside of this is that anyone that forks this repo won't get it as a GitHub Pages repo when they are working on it... because they have a different GitHub "username" (or "organisation name").

So the trick is to not use a master branch as the documentation tells you... rather, use a gh-pages branch, as you would for your other "Project Pages".

@saranyan
saranyan / mylibrary.rb
Created January 31, 2012 14:03
Testing Ruby FFI - Ruby Wrapper
# mylibrary.rb
TESTVAR = 2
module MyLibrary
extend FFI::Library
ffi_lib "mylibrary.so"
attach_function :calculate_something, [:int, :float], :double
attach_function :test_function_1, [:string], :string
attach_function :test_function_2, [:double, :pointer, :string], :int
attach_function :test_function_3, [], :void
attach_function :test_function_4, [:pointer], :void
@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) {
@saranyan
saranyan / get_message_schema.php
Created March 30, 2012 15:08
HT build a X.commerce capability PingPong
<?php
//get schema for ping
$schema_uri = "https://api.x.com/ocl/message/ping/1.0.0";
$content = file_get_contents($schema_uri);
$schema = AvroSchema::parse($content);
# 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
@saranyan
saranyan / Headers.txt
Created February 7, 2012 18:30
PHP and Ruby sample to send Avro messages to X.commerce fabric
AUTHORIZATION : Bearer QkEAARgyi3MPFsmP8St6L2Yc07DkYKQRt5MNo/7caN75haGqDTFDNH/meyYIpKa19Qt1rw==
X_XC_MESSAGE_GUID : f72b7e90-f7ee-4964-901b-6e2427a7c680
X_XC_PUBLISHER : TUQAAXOrYY3iyGbbL6IvNPGWJMaw4CrLBE7QTXIUFuJgo6gBIWPrCwOkXfhMLTbOJXAepw==
X_XC_SCHEMA_URI : https://ocl.xcommercecloud.com/marketplace/profile/deleted/1.0.0
X_XC_SCHEMA_VERSION : 1.0.0
X_XC_TENANT_ID : VEkAAalGt+ye8hDbMXeh8BAquNa72oifsoQNEtjQ9mTzZ8czA7M0+AcJQvDVVsN51DUgNw==
@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