#Stay Standalone
A short script to prevent internal links to a "webapp" added to iPhone home screen to open in Safari instead of navigating internally.
| require 'digest/md5' | |
| def gfm(text) | |
| # Extract pre blocks | |
| extractions = {} | |
| text.gsub!(%r{<pre>.*?</pre>}m) do |match| | |
| md5 = Digest::MD5.hexdigest(match) | |
| extractions[md5] = match | |
| "{gfm-extraction-#{md5}}" | |
| end |
| # A rake task to pull all your gists from github.com as html. | |
| # | |
| # This has advantages over the script embed: | |
| # * the script uses document.write, which is not compatible with XHTML Strict 1.0 | |
| # * document.write also can't be used after the document body has loaded (ie. no AJAX) | |
| # * the gists get indexed by search engines this way | |
| desc "Pull all gists from github and cache them locally" | |
| task :gists do | |
| uri = URI.parse 'http://gist.github.com/api/v1/yaml/gists/heisters' | |
| html = YAML.load(Net::HTTP.get(uri))['gists'].inject('') do |h, gist| |
| The regex patterns in this gist are intended to match any URLs, | |
| including "mailto:[email protected]", "x-whatever://foo", etc. For a | |
| pattern that attempts only to match web URLs (http, https), see: | |
| https://gist.github.com/gruber/8891611 | |
| # Single-line version of pattern: | |
| (?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’])) |
| module Jekyll | |
| class RawTag < Liquid::Block | |
| def parse(tokens) | |
| @nodelist ||= [] | |
| @nodelist.clear | |
| while token = tokens.shift | |
| if token =~ FullToken | |
| if block_delimiter == $1 | |
| end_tag |
| <!DOCTYPE html> | |
| <head> | |
| <title>Stay Standalone</title> | |
| <meta name="apple-mobile-web-app-capable" content="yes"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> | |
| <script src="stay_standalone.js" type="text/javascript"></script> | |
| </head> | |
| <body> | |
| <ul> | |
| <li><a href="http://google.com/">Remote Link (Google)</a></li> |
#Stay Standalone
A short script to prevent internal links to a "webapp" added to iPhone home screen to open in Safari instead of navigating internally.
| <?php | |
| $api = new DoodleAPI(); | |
| $api->createPoll(array( | |
| 'title' => 'Test Poll', | |
| 'description' => 'Test Description', | |
| 'fromName' => 'David Patierno', | |
| 'fromEmail' => '[email protected]', | |
| 'dates' => array( |
| /*jslint regexp: true, maxerr: 50, indent: 2 */ | |
| (function (global) { | |
| "use strict"; | |
| function URLUtils(url, baseURL) { | |
| var m = String(url).replace(/^\s+|\s+$/g, "").match(/^([^:\/?#]+:)?(?:\/\/(?:([^:@\/?#]*)(?::([^:@\/?#]*))?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/); | |
| if (!m) { | |
| throw new RangeError(); | |
| } |
| #!/usr/bin/env ruby | |
| # Processor for Github flavored markdown, inspired by: | |
| # https://github.com/alampros/Docter/blob/master/bin/github-flavored-markdown.rb | |
| # | |
| # Current version of this script can be found here: | |
| # https://gist.github.com/1300939 | |
| # | |
| # Adapted for Redcarpet version 2 by Ralph von der Heyden | |
| # http://github.com/ralph | |
| # http://twitter.com/ralph |