Skip to content

Instantly share code, notes, and snippets.

@ydn
ydn / flickr.js
Created March 5, 2015 20:16
Flickr API
<script>
var yqlCallback = function(data) {
console.log(data);
var photo = data.query.results.photo[0];
alert(photo.title);
};
</script>
<script src="https://query.yahooapis.com/v1/public/yql?q=select * from flickr.photos.search where has_geo='true' and tags='New York City' and api_key='YOUR KEY'&format=json&callback=yqlCallback"></script>
@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 / 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 / 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 / flurry_swift_events.swift
Last active August 29, 2015 14:22
Flurry Events
// AppDelegate.swift
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
// A basic Flurry Event
Flurry.logEvent("Started Application");
// Your code...
return true;
}
@ydn
ydn / flurry_error_logging.swift
Last active August 29, 2015 14:22
Flurry Error logging with Swift
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
var err: NSError?
// Log an error
Flurry.logError("ERROR_ID", "MESSAGE", exception: err);
// Your code...
}
@ydn
ydn / flurry_banner_ads.swift
Created June 9, 2015 20:32
Flurry Banner Ads with Swift
// ViewController.swift
class ViewController: UIViewController, FlurryAdBannerDelegate {
// Initialize Ad Banner Object
let adBanner = FlurryAdBanner(space:"ADSPACE");
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated);
adBanner.adDelegate = self;
adBanner.fetchAndDisplayAdInView(self.view, viewControllerForPresentation: self);
}
@ydn
ydn / flurry_takeover.swift
Last active August 29, 2015 14:22
Flurry Full-Screen Ads with Swift
// ViewController.swift
class ViewController: UIViewController, FlurryAdInterstitialDelegate {
let adInterstitial = FlurryAdInterstitial(space: "ADSPACE");
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated);
adInterstitial.adDelegate = self;
adInterstitial.fetchAd();
}
@ydn
ydn / swift_bannerads.swift
Last active August 29, 2015 14:22
Spotlight banner ads Swift Example
let adBanner = FlurryAdBanner(space:"ADSPACE");
adBanner.adDelegate = self;
adBanner.fetchAndDisplayAdInView(self.view, viewControllerForPresentation: self);
@ydn
ydn / full_screen_ads.swift
Created June 10, 2015 18:52
Full Screen Flurry Ads
if adInterstitial != nil && adInterstitial.ready {
adInterstitial.presentWithViewController(self);
} else {
adInterstitial.fetchAd();
}