Skip to content

Instantly share code, notes, and snippets.

@ydn
ydn / gist:359646
Created April 8, 2010 01:01
fetch flickr photos in javascript & put them on a page.
<!-- fetch flickr photos in javascript & put them on a page. Based on Jon LeBlanc's PHP code: http://developer.yahoo.net/blog/archives/2010/04/building_flickr_urls_from_yql_flickrphotossearch_results.html -->
<body>
<script>
function cbfunc(obj){
for(var i = 0; i < obj.query.results.photo.length; i++){
var farm = obj.query.results.photo[i].farm;
var server = obj.query.results.photo[i].server;
var id = obj.query.results.photo[i].id;
var secret = obj.query.results.photo[i].secret;
@ydn
ydn / gist:360872
Created April 9, 2010 03:31
a super-stripped down 2-leg oauth server/client example
<?php // a super-stripped down 2-leg oauth server/client example
//http://oauth.net/code/
//http://oauth.googlecode.com/svn/code/php/OAuth.php
require 'oauth.php';
$key = 'key';
$secret = 'secret';
$consumer = new OAuthConsumer($key, $secret);
$sig_method = new OAuthSignatureMethod_HMAC_SHA1;
@ydn
ydn / gist:361071
Created April 9, 2010 11:31
example code for doing the OAuth dance w/ Netflix in php
<?php // simple example code for doing the OAuth dance w/ netflix in php
//http://oauth.net/code/
//http://oauth.googlecode.com/svn/code/php/OAuth.php
require 'oauth.php';
//key/secret from http://developer.netflix.com
$key = 'slkdjf298374';
$secret = 'lskdjf0298374';
$consumer = new OAuthConsumer($key, $secret);
@ydn
ydn / simplePhpOpenid.php
Created April 27, 2010 01:11
simple code to require OpenID authentication on a page
<?php // simple code to require OpenID authentication on a page
/*
Requirements:
* PHP 5
* OpenID Enabled PHP library (http://openidenabled.com/php-openid/)
Usage:
1) Put this code in a file on your server
2) Edit the "$realm" variable to be your domain
//
// This block of code creates the YDN Rack module that supports searching within
// a set of docs. Previously, the only search functionality would scour the entire
// site for the terms entered. This module aims to provide contextual search
// within documentation so a user can more easily find something related to the
// docs currently being presented. We use a bunch of y! technology to do the heavy
// lifting and that's awesome that we just have to manufacture the glue.
//
@ydn
ydn / yui-2in3-modal-panel-example.html
Created January 11, 2011 02:44
Sample code for implementing a YUI 2 modal panel in YUI 3 using YUI 2in3.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>YUI 2in3 Modal Overlay Example</title>
</head>
@ydn
ydn / node-weather.js
Last active November 19, 2022 15:36
Weather API
var YQL = require('yql');
var query = new YQL('select * from weather.forecast where (location = 94089)');
query.exec(function(err, data) {
var location = data.query.results.channel.location;
var condition = data.query.results.channel.item.condition;
console.log('The current weather in ' + location.city + ', ' + location.region + ' is ' + condition.temp + ' degrees.');
});
@ydn
ydn / boss.cs
Last active March 12, 2021 13:26
BOSS Search API
using System;
using System.Net;
using OAuth;
namespace ConsoleApplication1{
class Program{
static void Main(string[] args){
string consumerKey = "...";
string consumerSecret = "...";
var uri = new Uri("https://yboss.yahooapis.com/ysearch/web?callback=json2&q=flu");
@ydn
ydn / node-placespotter.js
Created March 5, 2015 20:04
BOSS PlaceSpotter API
var request = require('request');
var qs = require('querystring');
var url = 'https://yboss.yahooapis.com/geo/placespotter';
var params = qs.stringify({
documentContent: 'Yahoo is headquartered in Sunnyvale, CA',
documentType: 'text/plain',
outputType: 'json'
});
@ydn
ydn / node-placefinder.js
Created March 5, 2015 20:11
BOSS PlaceFinder API
var request = require('request');
var qs = require('querystring');
var url = 'https://yboss.yahooapis.com/geo/placefinder';
var params = qs.stringify({
q: '701 First Ave, Sunnyvale, CA',
flags: 'J'
});