Prereqs:
- node and npm
- coffee-script npm package
Install meteor:
curl install.meteor.com | /bin/sh
Clone/copy these files into a directory
| # Sinatrize | |
| # usage: | |
| # | |
| # mkdir -p yourapp | |
| # cd yourapp | |
| # wget https://gist.githubusercontent.com/makevoid/2385559/raw/1fc0355a04ed2153d74b06386048d1e1541a0706/sinatrize.rb # if you are not sure get the latest gist by clicking on [Raw] | |
| # ruby sinatrize.rb | |
| # rm -f sinatrize.rb | |
| # bundle |
| <html> | |
| <head> | |
| <script type="text/javascript"> | |
| function onFailSoHard() { | |
| console.log("fail") | |
| } | |
| function sendSignalingChannel(message) { | |
| var xhr = new XMLHttpRequest(); | |
| xhr.open('POST', path, true); |
| # Hello ButtonView (world) | |
| class AppDelegate | |
| def application(application, didFinishLaunchingWithOptions:launchOptions) | |
| @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds) | |
| @window.rootViewController = ButtonViewController.alloc.init | |
| @window.makeKeyAndVisible | |
| return true | |
| end | |
| end |
Prereqs:
Install meteor:
curl install.meteor.com | /bin/sh
Clone/copy these files into a directory
| # encoding: utf-8 | |
| text = <<-LOL | |
| <!DOCTYPE html> | |
| <html class='no-js' lang='en'> | |
| <head> | |
| <meta charset='utf-8'> | |
| <title>5apps</title> | |
| <meta content='Deployment and distribution tools for HTML5 app developers' name='description'> | |
| <meta content='width=device-width, minimum-scale=1.0, maximum-scale=1.0' name='viewport'> |
| # simple scrape example with mechanize | |
| # | |
| # setup: gem install mechanize | |
| require 'mechanize' | |
| agent = Mechanize.new | |
| agent.user_agent = "Mac Firefox" | |
| host = "http://livescore.com/soccer/italy" |
| { | |
| "name": "Thorrents (hosted)", | |
| "description": "Thor agrees!", | |
| "version": "1.2", | |
| "manifest_version": 2, | |
| "app": { | |
| "urls": [ | |
| "http://thorrents.com/" | |
| ], | |
| "launch": { |
| var parser = document.createElement('a'); | |
| parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
| parser.protocol; // => "http:" | |
| parser.hostname; // => "example.com" | |
| parser.port; // => "3000" | |
| parser.pathname; // => "/pathname/" | |
| parser.search; // => "?search=test" | |
| parser.hash; // => "#hash" | |
| parser.host; // => "example.com:3000" |
| map = %Q{ | |
| function() { | |
| emit(this.name, { deployments: this.deployments }) | |
| } | |
| } | |
| reduce = %Q{ | |
| function(key, values) { | |
| var result = {} | |
| values.forEach(function(value) { |
| # http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically | |
| def hsv_to_rgb(h, s, v) | |
| h, s, v = h.to_f/360, s.to_f/100, v.to_f/100 | |
| h_i = (h*6).to_i | |
| f = h*6 - h_i | |
| p = v * (1 - s) | |
| q = v * (1 - f*s) | |
| t = v * (1 - (1 - f) * s) | |
| r, g, b = v, t, p if h_i==0 | |
| r, g, b = q, v, p if h_i==1 |