Skip to content

Instantly share code, notes, and snippets.

View jcleblanc's full-sized avatar

Jonathan LeBlanc jcleblanc

View GitHub Profile
@jcleblanc
jcleblanc / subscription_agreement.js
Created June 26, 2014 06:15
paypal_rest_subscriptions_user_agreement
curl -v POST https://api.sandbox.paypal.com/v1/payments/billing-agreements
-H 'Content-Type:application/json' \
-H 'Authorization: Bearer {accessToken}' \
-d '{
"name": "Main Subscription",
"description": "Fruit of the Month Subscription",
"start_date": "2015-02-19T00:37:04Z",
"plan": {
"id": "P-0NJ10521L3680291SOAQIVTQ"
},
USE 'http://www.jonleblanc.com/projects/yql/weather_locations.xml' AS weather_location; select * from weather.forecast where location in (SELECT loc.id FROM weather_location WHERE location='London' LIMIT 1);
<canvas id="test_canvas" width="400" height="400">
If the canvas element is not supported in your browser, this text will be displayed
</canvas>
var example = document.getElementById('test_canvas');
var context = example.getContext('2d');
context.fillStyle = "rgb(255,0,0)";
context.fillRect(30, 30, 50, 50);
<?xml version="1.0" encoding="UTF-8"?>
<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:count="10" yahoo:created="2010-03-31T06:27:19Z" yahoo:lang="en-US" yahoo:updated="2010-03-31T06:27:19Z" yahoo:uri="http://query.yahooapis.com/v1/yql?q=select+*+from+flickr.photos.search+where+has_geo%3D%22true%22+and+text%3D%22san+francisco%22">
<diagnostics>
<publiclyCallable>true</publiclyCallable>
<url execution-time="444"><![CDATA[http://api.flickr.com/services/rest/?method=flickr.photos.search&has_geo=true&text=san%20francisco&page=1&per_page=10]]></url>
<user-time>445</user-time>
<service-time>444</service-time>
<build-version>5275</build-version>
</diagnostics>
<results>
<?php
$yql_url = 'http://query.yahooapis.com/v1/public/yql?';
$query = 'SELECT * FROM flickr.photos.search WHERE has_geo="true" AND text="san francisco"';
$query_url = $yql_url . 'q=' . urlencode($query) . '&format=xml';
$photos = simplexml_load_file($query_url);
$result = build_photos($photos->results->photo);
echo $result;
function build_photos($photos){
<results>
<item>
<title>Browser MVC with YQL and YUI</title>
<link>http://www.slideshare.net/jcleblanc/browser-mvc-with-yql-and-yui</link>
<description><![CDATA[<img src="http://cdn.slidesharecdn.com/confoobrowsermvc03122010-100312101651-phpapp02-thumbnail-2?1268510282" alt ="" style="border:1px solid #C3E6D8;float:right;" /><br> YQL is a highly rich and dynamic utility for capturing data from any place on the web. When we couple this functionality with YUI we have wonderful functionality for designing apps and sites easily and that scale around MVC design patterns.]]></description>
<content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"><![CDATA[<img src="http://cdn.slidesharecdn.com/confoobrowsermvc03122010-100312101651-phpapp02-thumbnail-2?1268510282" alt ="" style="border:1px solid #C3E6D8;float:right;" /><br> YQL is a highly rich and dynamic utility for capturing data from any place on the web. When we couple this functionality with YUI we have wond
@jcleblanc
jcleblanc / bt_dropin_node_client.html
Created September 19, 2015 16:15
Braintree Drop-In UI Client Sample (Node)
<!DOCTYPE HTML>
<html>
<head>
<title>Dropin</title>
</head>
<body>
<form id="checkout" method="post" action="http://localhost:3000/checkout">
<div id="payment-form"></div>
<input type="submit" value="Make Payment">
@jcleblanc
jcleblanc / bt_dropin_node_server.js
Created September 19, 2015 16:15
Braintree Drop-In UI Express Server Sample (Node)
var express = require('express'),
bodyParser = require('body-parser'),
app = express(),
util = require('util'),
braintree = require('braintree');
app.use( bodyParser.json() ); // to support JSON-encoded bodies
app.use(bodyParser.urlencoded({ // to support URL-encoded bodies
extended: true
}));
<script type='text/javascript' src='yql_js_widget.js'></script>
<div id='widgetContainer'></div>
<script type='text/javascript'>
var config = {"debug":true};
var format = "<br style='clear:both' /><img src='{content}' width='620' height='500' alt='map' />";
var yqlQuery = "SELECT * FROM maps.map WHERE (latitude, longitude) IN (SELECT match.place.centroid.latitude, match.place.centroid.longitude FROM geo.placemaker WHERE documentURL = 'http://www.cnn.com/' AND documentType='text/html' AND appid='')";
var insertEl = "widgetContainer";