Skip to content

Instantly share code, notes, and snippets.

@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 / track_user_id.swift
Last active November 6, 2020 03:59
Track User ID
Flurry.setUserID("USER_ID");
@ydn
ydn / node-yql.js
Last active October 14, 2019 11:32
YQL 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 / gist:284358
Created January 23, 2010 01:18
publish an update w/ image to Yahoo! using the PHP SDK
<?php
/*
Purpose:
This script creates an oauth access token for you, and then
allows you to use that token to publish an update (that
includes a thumbnail picture) w/ the Yahoo! Updates API
Prerequisites
* A server with PHP 5
@ydn
ydn / gist:320165
Created March 3, 2010 00:34
Use YQL to convert XML to JSON in your sleep
<!-- Use YQL to convert XML to JSON in your sleep -->
<!-- Introduced in YDN blog post: http://developer.yahoo.net/blog/archives/2010/03/yql_code_samples_yql_is_easy_to_use.html -->
<script src="http://yui.yahooapis.com/3.0.0/build/yui/yui-min.js"></script>
<ul>UN Headlines:</ul>
<script>
var Y = new YUI();
function handleResponse ( json ) {
var items = json.query.results.item;
for ( var i = 0; i < items.length; i++ ) {
@ydn
ydn / gemini.php
Created March 5, 2015 20:20
Gemini API
<?php
/* Example code to access Gemini API: Fetch advertiser information, create a new campaign and read specific campaign data
Prerequisites:
1. Sign up for an account on https://admanager.yahoo.com
2. Download YahooOAuth2.class.php file from here: https://github.com/saurabhsahni/php-yahoo-oauth2/blob/master/YahooOAuth2.class.php
3. PHP modules for json_decode & curl
4. A webserver running this code on port 80/443. Yahoo OAuth callback is only supported on these ports
*/
require "YahooOAuth2.class.php";
@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 / flurry_user_sessions.swift
Last active March 28, 2017 19:46
Integrate Flurry Analytics
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
Flurry.startSession("YOUR_FLURRY_API_KEY");
// Your code...
return true;
}
@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'
});