Skip to content

Instantly share code, notes, and snippets.

View bsullins's full-sized avatar

Ben Sullins bsullins

View GitHub Profile
@bsullins
bsullins / index.html
Last active August 29, 2015 13:56
D3js - Working with External Data
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<body>
<h1>Hello World!</h1>
<script>
d3.html("http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22https%3A%2F%2Fcoinbase.com%2Fapi%2Fv1%2Fprices%2Fhistorical%22&format=xml&diagnostics=true&callback=cbfunc", function(error, data) {
if(error){
console.log(error);
{ "data": [
{
"category": "Furniture",
"region": "West",
"monthlySales":
[{
"month":20130101,
"sales":38
},
@bsullins
bsullins / tableau-github-post
Last active August 29, 2015 14:04
tableau to github
<h4>The Dilemma</h4>
Your Tableau Server instance has a backup policy in place (please say yes) but you also want to ensure your most valuable Tableau Server workbooks are always somewhere safe and secure. What’s more, you’ll have <b>version control</b>!
<h4>The Catch</h4>
It should all be automatic. No living soul should ever touch this process (except when it needs some upgrades and further improvements). And in keeping with the spirit of ‘utility’, it should be small, fast, and functional.
<h4>The High-Level Steps</h4>
You’ll need a PostgreSQL script to grab workbook names for export with <a href="http://onlinehelp.tableausoftware.com/current/server/en-us/tabcmd_cmd.htm">tabcmd get</a><b><i>. </i></b>You’ll use this query inside your PowerShell script (file: <a href="https://github.com/MikeRobertsPS/TsHacks">TsGetWorkbookDownloadURL</a>) which leverages the outputted csv for workbook names.
[code]SELECT
w.id as "WorkbookId"
, w.name
<!DOCTYPE html>
<html>
<title>I'm an HTML file!</title>
<!-- Replace the reference to the JS API on Tableau Public to your server -->
<script type="text/javascript" src="http://public.tableausoftware.com/javascripts/api/tableau_v8.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
@bsullins
bsullins / tableau-sso-post.php
Created February 3, 2015 17:50
Wordpress Tableau Server SSO
<?php
//get dashboard if one is setup
global $current_user;
get_currentuserinfo();
// $custom_fields = get_post_custom_values('dashboard_url'); //post must have this configured
// $dashboard_url = $custom_fields[0]; //the first value, there technically could be more than 1
@bsullins
bsullins / mi-embedding.php
Last active August 29, 2015 14:26
Embedding Metric Insights PHP sample
<?php
define('BASE_URL','https://metrics.pluralsight.com');
define('APPLICATION_ID','...');
define('APPLICATION_KEY','...');
$ch = curl_init(BASE_URL.'api/get_ticket/');
curl_setopt($ch, CURLOPT_POSTFIELDS, array('application_id'=>APPLICATION_ID,
@bsullins
bsullins / metric-insights-wordpress-sso.php
Created August 11, 2015 03:01
Trusted Ticket Integration for Metric Insights and Wordpress that does not require php-json module
<?php
define('BASE_URL','metircs.mycompany.com');
define('APPLICATION_ID','...');
define('APPLICATION_KEY','...');
@bsullins
bsullins / gist:6031191
Created July 18, 2013 17:25
DDL for Tableau Superstore 1B row table
create table numbers (
num int
);
create table superstore_orders (
RowID integer
, OrderID integer
, OrderDate varchar(50)
, OrderPriority varchar(50)
import sys
import bitly_api
import os
import datetime
from datetime import date
from config import config
import time
#connect to bitly