Skip to content

Instantly share code, notes, and snippets.

@nathansmith
Last active December 15, 2015 11:49
Show Gist options
  • Select an option

  • Save nathansmith/5256203 to your computer and use it in GitHub Desktop.

Select an option

Save nathansmith/5256203 to your computer and use it in GitHub Desktop.

Revisions

  1. nathansmith revised this gist Mar 28, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion #1 manifest_time.rb
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ def manifest_time

    # Seconds changes too frequently for
    # manifest, so HH:MM:00 or HH:MM:30.
    sec = t.sec > 30 ? 00 : 30
    sec = t.sec > 30 ? 0 : 30

    # Outputs this format... 2013-03-27 12:11:00 UTC
    return Time.utc(year, month, day, hour, min, sec)
  2. nathansmith revised this gist Mar 28, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion #1 manifest_time.rb
    Original file line number Diff line number Diff line change
    @@ -12,5 +12,5 @@ def manifest_time
    sec = t.sec > 30 ? 00 : 30

    # Outputs this format... 2013-03-27 12:11:00 UTC
    return Time.utc(year, month, day, hour, min, sec);
    return Time.utc(year, month, day, hour, min, sec)
    end
  3. nathansmith revised this gist Mar 28, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion #1 manifest_time.rb
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ def manifest_time
    min = t.min

    # Seconds changes too frequently for
    # manifest. Do HH:MM:30 or HH:MM:00.
    # manifest, so HH:MM:00 or HH:MM:30.
    sec = t.sec > 30 ? 00 : 30

    # Outputs this format... 2013-03-27 12:11:00 UTC
  4. nathansmith revised this gist Mar 27, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions #1 manifest_time.rb
    Original file line number Diff line number Diff line change
    @@ -8,8 +8,8 @@ def manifest_time
    min = t.min

    # Seconds changes too frequently for
    # manifest, so force it to HH:MM:00.
    sec = '00'
    # manifest. Do HH:MM:30 or HH:MM:00.
    sec = t.sec > 30 ? 00 : 30

    # Outputs this format... 2013-03-27 12:11:00 UTC
    return Time.utc(year, month, day, hour, min, sec);
  5. nathansmith revised this gist Mar 27, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion #2 manifest.appcache.rb
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@

    NETWORK:

    ../whatever
    ../json
    #----------------------------------------------------------------------------------------------------
  6. nathansmith revised this gist Mar 27, 2013. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion #3 example.html
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,9 @@
    <head>
    <meta charset="utf-8" />
    <meta http-equiv="x-ua-compatible" content="ie=edge" />
    <title>Manifest Example</title>
    <title>
    Manifest Example
    </title>
    <link rel="stylesheet" href="./stylesheets/application.css" />
    </head>
    <body>
  7. nathansmith revised this gist Mar 27, 2013. 3 changed files with 0 additions and 0 deletions.
    File renamed without changes.
    File renamed without changes.
    File renamed without changes.
  8. nathansmith revised this gist Mar 27, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 1 manifest_time.rb
    Original file line number Diff line number Diff line change
    @@ -11,6 +11,6 @@ def manifest_time
    # manifest, so force it to HH:MM:00.
    sec = '00'

    # Will output like this... 2013-03-27 12:11:00 UTC
    # Outputs this format... 2013-03-27 12:11:00 UTC
    return Time.utc(year, month, day, hour, min, sec);
    end
  9. nathansmith revised this gist Mar 27, 2013. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions 1 manifest_time.rb
    Original file line number Diff line number Diff line change
    @@ -11,5 +11,6 @@ def manifest_time
    # manifest, so force it to HH:MM:00.
    sec = '00'

    # Will output like this... 2013-03-27 12:11:00 UTC
    return Time.utc(year, month, day, hour, min, sec);
    end
  10. nathansmith revised this gist Mar 27, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 3 example.html
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    <!DOCTYPE html>
    <html lang="en" manifest="./path/manifest.appcache">
    <html lang="en" manifest="./offline/manifest.appcache">
    <head>
    <meta charset="utf-8" />
    <meta http-equiv="x-ua-compatible" content="ie=edge" />
  11. nathansmith revised this gist Mar 27, 2013. 3 changed files with 0 additions and 0 deletions.
    File renamed without changes.
    File renamed without changes.
    File renamed without changes.
  12. nathansmith revised this gist Mar 27, 2013. 3 changed files with 0 additions and 0 deletions.
    File renamed without changes.
    File renamed without changes.
    File renamed without changes.
  13. nathansmith created this gist Mar 27, 2013.
    15 changes: 15 additions & 0 deletions example.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    <!DOCTYPE html>
    <html lang="en" manifest="./path/manifest.appcache">
    <head>
    <meta charset="utf-8" />
    <meta http-equiv="x-ua-compatible" content="ie=edge" />
    <title>Manifest Example</title>
    <link rel="stylesheet" href="./stylesheets/application.css" />
    </head>
    <body>
    <p>
    Just an example.
    </p>
    <script src="./javascripts/application.js"></script>
    </body>
    </html>
    46 changes: 46 additions & 0 deletions manifest.appcache.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,46 @@
    CACHE MANIFEST

    # LAST UPDATED: <%= manifest_time %>

    #----------------------------------------------------------------------------------------------------

    #
    # INTERNET CONNECTION REQUIRED...
    #

    NETWORK:

    ../whatever
    #----------------------------------------------------------------------------------------------------
    #
    # CACHE THESE FILES OFFLINE...
    #
    CACHE:
    #
    # CSS
    #
    ../stylesheets/application.css

    #
    # JavaScript
    #

    ../javascripts/jquery.js
    ../javascripts/application.js

    #
    # HTML
    #

    ../whatever.html
    #
    # Images
    #
    ../images/whatever.png
    15 changes: 15 additions & 0 deletions manifest_time.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    # Used to cache-bust <html manifest="..."> locally
    def manifest_time
    t = Time.now
    year = t.year
    month = t.month
    day = t.day
    hour = t.hour
    min = t.min

    # Seconds changes too frequently for
    # manifest, so force it to HH:MM:00.
    sec = '00'

    return Time.utc(year, month, day, hour, min, sec);
    end