Skip to content

Instantly share code, notes, and snippets.

View bsullins's full-sized avatar

Ben Sullins bsullins

View GitHub Profile
@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
@bsullins
bsullins / gist:6127012
Last active December 20, 2015 11:59
bit.ly script to get clicks by country by day for popular links
import sys
import bitly_api
import os
import datetime
from datetime import date
from config import config
import time
#connect to bitly
@bsullins
bsullins / viztalkjs
Created October 10, 2013 18:20
Add togetherjs to your Tableau Server implementation for real-time collaboration on data visualizations
<script src="https://togetherjs.com/togetherjs-min.js"></script>
<script type="text/javascript">
// add button for viz talk
window.onload = function() {
var buttons=document.getElementsByClassName('tab-masthead-toolbar')[0];
var new_button=document.createElement('a');
var new_button_text=document.createTextNode('VizTalk');
new_button.setAttribute('onclick','TogetherJS(this); return false;');
@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