Skip to content

Instantly share code, notes, and snippets.

View BastinRobin's full-sized avatar
🏠
Working from home

Bastin Robin BastinRobin

🏠
Working from home
View GitHub Profile
@BastinRobin
BastinRobin / GetLatLong.js
Last active May 9, 2023 01:06
Get Latitude And Longitude Javascript Function
/* Get the latitude and longitude from address:
Author : Bastin Robins J
*/
// Add the link to webpage
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
//Function to covert address to Latitude and Longitude
var getLocation = function(address) {
var geocoder = new google.maps.Geocoder();
<style type="text/css">p {text-align:center;width: auto}</style>

Created by Christopher Manning

Gallery

Axle Eight [Fibbobaci](http://bl.ocks.org/d/1703449/#/[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169]43/0/1) [Florets](http://bl.ocks.

@BastinRobin
BastinRobin / dataframetoJson.py
Created December 2, 2013 11:30
Pandas Dataframes to JSON
import pandas as pd
import json
data = pd.read_csv('sample.csv')
d = [
dict([
(colname, row[i])
for i,colname in enumerate(data.columns)
])
for row in data.values
@BastinRobin
BastinRobin / app.js
Created December 25, 2013 08:14 — forked from arvis/app.js
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, http = require('http')
, mongoose = require('mongoose')
, path = require('path');
@BastinRobin
BastinRobin / mail.php
Created January 10, 2014 05:05
PHP Mail Snippet [Table View]
<?php
// Compose the mail
$to = "imail@example.co.uk";
$subject = "Enquiry from Example";
$headers = "From: " . strip_tags($_POST['email']) . "\r\n";
$headers .= "Reply-To: ". strip_tags($_POST['email']) . "\r\n";
$headers .= "CC: email@gmail.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

This example shows how it is possible to use a D3 sunburst visualization (partition layout) with data that describes sequences of events.

A good use case is to summarize navigation paths through a web site, as in the sample synthetic data file (visit_sequences.csv). The visualization makes it easy to understand visits that start directly on a product page (e.g. after landing there from a search engine), compared to visits where users arrive on the site's home page and navigate from there. Where a funnel lets you understand a single pre-selected path, this allows you to see all possible paths.

Features:

  • works with data that is in a CSV format (you don't need to pre-generate a hierarchical JSON file, unless your data file is very large)
  • interactive breadcrumb trail helps to emphasize the sequence, so that it is easy for a first-time user to understand what they are seeing
  • percentages are shown explicitly, to help overcome the distortion of the data that occurs wh

Conventions:

Defining Eloquent model (will assume that DB table named is set as plural of class name and primary key named "id"):

class Shop extends Eloquent {}

Using custom table name

protected $table = 'my_shops';

@BastinRobin
BastinRobin / wait.c
Created July 19, 2014 16:40
Wait Snipped in C++
#include<stdio.h>
#include<string.h>
#include<time.h>
void wait ( int seconds )
{
clock_t endwait;
endwait = clock () + seconds * CLOCKS_PER_SEC ;
while (clock() < endwait) {}
}
@BastinRobin
BastinRobin / execute.c
Last active August 29, 2015 14:05
Run C Program using Filename as argument
/**
compile: gcc execute.c
run : ./a.out "filename"
**/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{