Skip to content

Instantly share code, notes, and snippets.

@nowherenearithaca
nowherenearithaca / README.md
Last active Jul 17, 2016
css "paint-order" example
View README.md

A simple example illustrating the css paint-order property.

View index.html
<!DOCTYPE html>
<meta charset="utf-8">
Hello, world!
@nowherenearithaca
nowherenearithaca / gist:5014255
Created Feb 22, 2013
Snippet for putting the iAd at the TOP of the screen rather than the bottom in a PhoneGap app; this is a slight tweak of the code in Scott DeSapio's note: http://engineering.scottdesapio.com/2013/02/add-iad-to-phonegap-application.html
View gist:5014255
- (void)webViewDidFinishLoad:(UIWebView*)theWebView
{
// Black base color for background matches the native apps
theWebView.backgroundColor = [UIColor blackColor];
adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
CGRect adFrame = adView.frame;
if([UIApplication sharedApplication].statusBarOrientation
== UIInterfaceOrientationPortrait
|| [UIApplication sharedApplication].statusBarOrientation
@nowherenearithaca
nowherenearithaca / MainViewController.m
Last active Dec 14, 2015
Snippet for handling external links in a PhoneGap app. I don't know the original source for this.
View MainViewController.m
- (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
NSURL *url = [request URL];
// Intercept the external http requests and forward to Safari.app
// Otherwise forward to the PhoneGap WebView
if ([[url scheme] isEqualToString:@"http"] || [[url scheme] isEqualToString:@"https"]) {
[[UIApplication sharedApplication] openURL:url];
return NO;
}
View index.html
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.29.1"></script>
<style type="text/css">
html, body, #map {
width: 100%;
View snippet.html
<script type="text/javascript" src="https://platform.twitter.com/widgets.js"></script>
<a href="https://twitter.com/intent/tweet?in_reply_to=51113028241989632">Reply</a>
<a href="https://twitter.com/intent/retweet?tweet_id=51113028241989632">Retweet</a>
<a href="https://twitter.com/intent/favorite?tweet_id=51113028241989632">Favorite</a>