Skip to content

Instantly share code, notes, and snippets.

@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'
});
@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 / 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_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 / 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_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 / FlurryNativeAdCallbacks.swift
Created June 10, 2015 20:31
Flurry Native Ad integration callbacks
class ViewController: UIViewController, FlurryAdNativeDelegate {
// For instance, the two most frequently used callbacks are:
func adNativeDidFetchAd(nativeAd: FlurryAdNative!){
// The SDK returns this callback for every instance of the native ad fetched
// The FlurryAd object contains all of the ad assets
}
// Informational callback invoked when there is an ad error
func adNative(nativeAd: FlurryAdNative!, adError: FlurryAdError, errorDescription: NSError!){
@ydn
ydn / native_ads.swift
Created June 10, 2015 18:56
Native Ads Swift Example
let nativeAd = FlurryAdNative(space: "ADSPACE");
nativeAd.adDelegate = self;
nativeAd.viewControllerForPresentation = self;
nativeAd.fetchAd();
nativeAd.trackingView = 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();
}
@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);