Skip to content

Instantly share code, notes, and snippets.

@dangerouse
dangerouse / lazy.html
Last active September 29, 2015 10:08
Lazy loaded widget that waits for the user's click to add the Cloudsponge resources to the page.
<!DOCTYPE html>
<html>
<body>
<!--
This sample page adds a link to launch the cloudsponge widget only if the user clicks.
This will reduce the load time of your page and is especially useful if the primary
purpose of the page is not importing address books.
The page only depends on the Cloudsponge Widget script.
-->
@dangerouse
dangerouse / mailing_address.html
Last active July 20, 2016 20:08
CloudSponge Widget Reference - Including mailing addresses in contacts data
<!DOCTYPE html>
<html>
<head>
<!--
Include the script anywhere on your page, usually in the head
(don't forget to replace `localhost-only` with your own CloudSponge Widget Key)
-->
<script src="//api.cloudsponge.com/widget/localhost-only.js"></script>
<script>
// extra widget options:
@dangerouse
dangerouse / gist:1586071
Last active September 29, 2015 10:17
Cloudsponge Proxy Reference - Python & Django
# Cloudsponge proxy reference
# Python reference implementation using django
#
# contributed by Dannie Chu of foodoro.com
from django.http import HttpResponse, HttpResponseRedirect
# from fdr.logging.logger import Logger
from urllib2 import HTTPRedirectHandler
import urllib
import urllib2
@dangerouse
dangerouse / padded_sidebar.html
Created January 10, 2012 04:23
Fixed sidebar with header boundary using jQuery
<!DOCTYPE html>
<html>
<body>
Content that stays put...
<div id="sidebar" style="height:3000px">
<div id="scroller-anchor"></div>
<div id="scrolling-content">
The content that scrolls!
</div>
</div>
@dangerouse
dangerouse / create.html
Created January 12, 2012 18:55
Very simple jQuery Ajax form
<div>A new bit of data added.</div>
@dangerouse
dangerouse / child.html
Last active July 19, 2016 20:21
Cloudsponge Widget Reference - Launching the widget from an iframe
<!DOCTYPE HTML>
<html>
<body>
<h2>IFrame Import Child Page</h2>
<!--
Create a custom link to start the import process
-->
<a href="#" onclick="return parent.cloudsponge.launch();">
Add from Address Book
@dangerouse
dangerouse / Default.aspx
Created January 16, 2012 22:15
Cloudsponge Proxy Reference - .Net
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="CloudSpongeProxy._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<asp:Label ID="lblContent" runat="server"></asp:Label>
@dangerouse
dangerouse / proxy.rb
Last active October 14, 2015 05:37
Cloudsponge Proxy Reference - Ruby
require 'cloudsponge'
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
render :text => response.try(:body)
@dangerouse
dangerouse / proxy.conf
Created January 16, 2012 22:42
Cloudsponge Proxy Reference - Nginx
location /proxy/ {
proxy_pass https://api.cloudsponge.com/auth;
}
@dangerouse
dangerouse / httpd.conf
Created January 16, 2012 22:44
Cloudsponge Proxy Reference - Apache
ProxyPass /foo http://foo.example.com/bar
ProxyPassReverse /foo http://foo.example.com/bar