Skip to content

Instantly share code, notes, and snippets.

@dangerouse
dangerouse / custom-close.html
Last active August 29, 2015 13:57
CloudSponge Widget Reference - Custom Close Button
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>custom-close</title>
<style type="text/css" media="screen">
/*
change the background image of the close link
TODO: update this url to reference your custom close button
*/
@dangerouse
dangerouse / auto-logout.html
Last active August 29, 2015 14:00
CloudSponge Widget Reference - Custom Close Button
<!DOCTYPE html>
<html>
<body>
<p>
<a class="cs_import">Add from address book</a>
<!-- This textarea will be populated with the contacts returned by CloudSponge -->
<textarea id="contact_list" style="width:450px;height:82px"></textarea>
</p>
# given a branch like 750-feature-name
# gcb 750
# sponge $ gcb 750
# checking out 750-feature-name
# Switched to branch '750-feature-name'
function gcb() {
branches=`git branch`
branchName=`echo "$branches" | grep $1`
branchName=`echo "$branchName" | sed s/\*//`
echo "checking out $branchName"
@dangerouse
dangerouse / cloudsponge_controller.rb
Created October 15, 2014 19:32
CloudSponge Proxy Controller - Ruby
require 'cloudsponge'
class CloudspongeController < ApplicationController
def cloudsponge_proxy
url = Cloudsponge::URL_BASE + 'auth?' + request.query_string
response = Cloudsponge::Utility::get_url(url);
if response.is_a?(Net::HTTPRedirection)
redirect_to response["location"]
else
@dangerouse
dangerouse / launch-from-div.html
Last active August 29, 2015 14:10
CloudSponge Widget - Launch from a div instead of an anchor
<!DOCTYPE html>
<html>
<head>
<script>
(function(u){
var d=document,s='script',a=d.createElement(s),m=d.getElementsByTagName(s)[0];
a.async=1;a.src=u;m.parentNode.insertBefore(a,m);
})('//api.cloudsponge.com/widget/YOUR_WIDGET_SCRIPT.js');
</script>
</head>
@dangerouse
dangerouse / webhooks-jquery.js
Created February 4, 2015 17:36
CloudSponge Widget Example - Web Hooks (using jquery)
<!DOCTYPE html>
<html>
<body>
<!-- Any link with a class="cs_import" will start the import process -->
<a class="cs_import">Add from Address Book</a>
<!-- Include the script anywhere on your page -->
<script>
// set any options here, for this example, we'll simply populate the contacts in the textarea above
@dangerouse
dangerouse / import.rb
Created March 4, 2015 18:02
Basic CloudSponge API import program
#!/usr/bin/env ruby
require "httparty" # Yes, I do like to party
# constants
host = "https://api.cloudsponge.com"
debug = 1
# data to send to the server
service = ARGV[0] || "gmail"
@dangerouse
dangerouse / gist:67a6fc4a36eeec0c3657
Created March 25, 2015 03:57
CloudSponge Widget Options - Close the widget during the beforeImport callback
window.csPageOptions = {
beforeImport: function(source, id) {
console.log('beforeImport('+source+','+id+')');
cloudsponge.end();
}
}
@dangerouse
dangerouse / csv_form.html
Created May 22, 2015 06:28
Sample CloudSponge CSV Upload Form
<form accept-charset="UTF-8" action="{{ begin_import_response.consent_url }}" enctype="multipart/form-data" id="fileupload" method="post">
<input type="file" name="csv_file" accept="text/csv|text/vcard">
</form>
@dangerouse
dangerouse / include.html
Created May 27, 2015 16:14
CloudSponge Widget Reference - Universal Snippet Include
<script>
// Asynchronously include the widget library.
// TODO: replace YOUR_WIDGET_SCRIPT with your widget script
(function(u){
var d=document,s='script',a=d.createElement(s),m=d.getElementsByTagName(s)[0];
a.async=1;a.src=u;m.parentNode.insertBefore(a,m);
})('//api.cloudsponge.com/widget/YOUR_WIDGET_SCRIPT.js');
</script>