ki 0.3.3 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +1 -1
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +2 -21
- data/Gemfile.lock +60 -100
- data/Guardfile +1 -1
- data/LICENSE.md +21 -0
- data/README.md +63 -0
- data/Rakefile +3 -45
- data/bin/ki +1 -1
- data/ki.gemspec +31 -137
- data/lib/ki.rb +21 -21
- data/lib/ki/api_error.rb +28 -0
- data/lib/ki/base_request.rb +34 -0
- data/lib/ki/helpers.rb +55 -0
- data/lib/ki/ki.rb +40 -0
- data/lib/ki/ki_cli.rb +46 -0
- data/lib/ki/ki_config.rb +20 -0
- data/lib/ki/middleware.rb +155 -0
- data/lib/ki/model.rb +70 -0
- data/lib/{modules → ki/modules}/callbacks.rb +0 -0
- data/lib/ki/modules/format_of.rb +10 -0
- data/lib/{modules → ki/modules}/model_helpers.rb +0 -12
- data/lib/ki/modules/public_file_helper.rb +13 -0
- data/lib/ki/modules/query_interface.rb +36 -0
- data/lib/{modules → ki/modules}/restrictions.rb +0 -30
- data/lib/ki/modules/view_helper.rb +13 -0
- data/lib/ki/orm.rb +65 -0
- data/lib/ki/version.rb +3 -0
- data/spec/examples/base/.ruby-gemset +1 -0
- data/spec/examples/base/.ruby-version +1 -0
- data/spec/examples/base/Gemfile +4 -0
- data/spec/examples/base/app.rb +1 -0
- data/{examples → spec/examples}/base/config.ru +0 -3
- data/spec/examples/base/config.yml +17 -0
- data/spec/examples/base/public/favicon.ico +0 -0
- data/spec/examples/base/public/javascripts/.gitkeep +0 -0
- data/spec/examples/base/public/stylesheets/.gitkeep +0 -0
- data/spec/examples/base/views/index.haml +6 -0
- data/spec/examples/couch-lock/.ruby-gemset +1 -0
- data/spec/examples/couch-lock/.ruby-version +1 -0
- data/spec/examples/couch-lock/Gemfile +4 -0
- data/spec/examples/couch-lock/Gemfile.lock +48 -0
- data/spec/examples/couch-lock/app.rb +42 -0
- data/spec/examples/couch-lock/config.ru +3 -0
- data/spec/examples/couch-lock/config.yml +17 -0
- data/spec/examples/couch-lock/install.sh +3 -0
- data/spec/examples/couch-lock/public/favicon.ico +0 -0
- data/spec/examples/couch-lock/public/javascripts/.gitkeep +0 -0
- data/spec/examples/couch-lock/public/stylesheets/.gitkeep +0 -0
- data/spec/examples/couch-lock/views/index.haml +18 -0
- data/spec/examples/json.northpole.ro/.ruby-gemset +1 -0
- data/spec/examples/json.northpole.ro/.ruby-version +1 -0
- data/spec/examples/json.northpole.ro/Capfile +25 -0
- data/spec/examples/json.northpole.ro/Gemfile +6 -0
- data/spec/examples/json.northpole.ro/Gemfile.lock +68 -0
- data/spec/examples/json.northpole.ro/app.rb +79 -0
- data/spec/examples/json.northpole.ro/client.rb +25 -0
- data/spec/examples/json.northpole.ro/config.ru +3 -0
- data/spec/examples/json.northpole.ro/config.yml +17 -0
- data/spec/examples/json.northpole.ro/config/deploy.rb +59 -0
- data/spec/examples/json.northpole.ro/config/deploy/production.rb +39 -0
- data/spec/examples/json.northpole.ro/foo.rb +10 -0
- data/spec/examples/json.northpole.ro/public/JNorthPole.jar +0 -0
- data/spec/examples/json.northpole.ro/public/favicon.ico +0 -0
- data/spec/examples/json.northpole.ro/public/font/FontAwesome.otf +0 -0
- data/spec/examples/json.northpole.ro/public/font/fontawesome-webfont.eot +0 -0
- data/spec/examples/json.northpole.ro/public/font/fontawesome-webfont.svg +284 -0
- data/spec/examples/json.northpole.ro/public/font/fontawesome-webfont.ttf +0 -0
- data/spec/examples/json.northpole.ro/public/font/fontawesome-webfont.woff +0 -0
- data/spec/examples/json.northpole.ro/public/images/bear.png +0 -0
- data/spec/examples/json.northpole.ro/public/images/bg.png +0 -0
- data/spec/examples/json.northpole.ro/public/images/cloud.png +0 -0
- data/spec/examples/json.northpole.ro/public/images/dotnet.png +0 -0
- data/spec/examples/json.northpole.ro/public/images/dotnet_small.png +0 -0
- data/spec/examples/json.northpole.ro/public/images/footer.png +0 -0
- data/spec/examples/json.northpole.ro/public/images/glyphicons-halflings-white.png +0 -0
- data/spec/examples/json.northpole.ro/public/images/glyphicons-halflings.png +0 -0
- data/spec/examples/json.northpole.ro/public/images/ice.png +0 -0
- data/spec/examples/json.northpole.ro/public/images/java.png +0 -0
- data/spec/examples/json.northpole.ro/public/images/java_small.png +0 -0
- data/spec/examples/json.northpole.ro/public/images/json.png +0 -0
- data/spec/examples/json.northpole.ro/public/images/json_small.png +0 -0
- data/spec/examples/json.northpole.ro/public/images/logo.png +0 -0
- data/spec/examples/json.northpole.ro/public/images/mobile.png +0 -0
- data/spec/examples/json.northpole.ro/public/images/php.png +0 -0
- data/spec/examples/json.northpole.ro/public/images/php_small.png +0 -0
- data/spec/examples/json.northpole.ro/public/images/python.png +0 -0
- data/spec/examples/json.northpole.ro/public/images/python_small.png +0 -0
- data/spec/examples/json.northpole.ro/public/images/ruby.png +0 -0
- data/spec/examples/json.northpole.ro/public/images/ruby_small.png +0 -0
- data/spec/examples/json.northpole.ro/public/images/shell.png +0 -0
- data/spec/examples/json.northpole.ro/public/images/shell_small.png +0 -0
- data/spec/examples/json.northpole.ro/public/javascripts/analytics.js +9 -0
- data/spec/examples/json.northpole.ro/public/javascripts/app.coffee +133 -0
- data/spec/examples/json.northpole.ro/public/javascripts/docs.min.js +16 -0
- data/spec/examples/json.northpole.ro/public/javascripts/jnorthpole.coffee +34 -0
- data/spec/examples/json.northpole.ro/public/javascripts/util.coffee +31 -0
- data/spec/examples/json.northpole.ro/public/stylesheets/app.sass +23 -0
- data/spec/examples/json.northpole.ro/public/stylesheets/application.sass +222 -0
- data/spec/examples/json.northpole.ro/public/stylesheets/cover.css +154 -0
- data/spec/examples/json.northpole.ro/views/curl.haml +19 -0
- data/spec/examples/json.northpole.ro/views/doc.haml +16 -0
- data/spec/examples/json.northpole.ro/views/doc_table.haml +45 -0
- data/spec/examples/json.northpole.ro/views/dotnet.haml +24 -0
- data/spec/examples/json.northpole.ro/views/examples.haml +28 -0
- data/spec/examples/json.northpole.ro/views/faq.haml +32 -0
- data/spec/examples/json.northpole.ro/views/foo.haml +7 -0
- data/spec/examples/json.northpole.ro/views/index.haml +4 -0
- data/spec/examples/json.northpole.ro/views/java.haml +0 -0
- data/spec/examples/json.northpole.ro/views/layout.haml +42 -0
- data/spec/examples/json.northpole.ro/views/php.haml +37 -0
- data/spec/examples/json.northpole.ro/views/playground.haml +38 -0
- data/spec/examples/json.northpole.ro/views/python.haml +17 -0
- data/spec/examples/json.northpole.ro/views/ruby.haml +12 -0
- data/spec/examples/json.northpole.ro/views/signup.haml +2 -0
- data/spec/examples/json.northpole.ro/views/thanks.haml +12 -0
- data/spec/functional_spec.rb +4 -0
- data/spec/lib/ki/base_request_spec.rb +88 -0
- data/spec/lib/ki/helpers_spec.rb +12 -0
- data/spec/lib/ki/ki_config_spec.rb +7 -0
- data/spec/lib/ki/middleware_spec.rb +11 -0
- data/spec/lib/ki/model_spec.rb +100 -0
- data/spec/lib/ki/modules/format_of_spec.rb +15 -0
- data/spec/lib/ki/orm_spec.rb +83 -0
- data/spec/spec_helper.rb +18 -5
- data/spec/util_spec.rb +7 -36
- metadata +269 -193
- data/.document +0 -5
- data/.rvmrc +0 -1
- data/LICENSE.txt +0 -20
- data/README.rdoc +0 -3
- data/VERSION +0 -1
- data/examples/base/Gemfile +0 -3
- data/examples/base/Gemfile.lock +0 -24
- data/examples/base/app.rb +0 -4
- data/examples/base/config.yml +0 -16
- data/gfx/colors.xcf +0 -0
- data/gfx/ki3.eps +0 -0
- data/gfx/logo.png +0 -0
- data/ki_wrap.rb +0 -35
- data/lib/conf.rb +0 -28
- data/lib/db.rb +0 -73
- data/lib/helpers.rb +0 -34
- data/lib/ki_cli.rb +0 -76
- data/lib/mockreq.rb +0 -45
- data/lib/model.rb +0 -110
- data/lib/modules/email.rb +0 -51
- data/lib/modules/query_interface.rb +0 -42
- data/lib/req.rb +0 -57
- data/lib/resp.rb +0 -70
- data/lib/static_file.rb +0 -68
- data/lib/util.rb +0 -114
- data/lib/views/404.haml +0 -1
- data/lib/views/406.haml +0 -1
- data/lib/views/index.haml +0 -7
- data/lib/views/layout.haml +0 -1
- data/spec/conf_spec.rb +0 -6
- data/spec/db_spec.rb +0 -93
- data/spec/integration/integration_spec.rb +0 -114
- data/spec/ki_spec.rb +0 -7
- data/spec/model_spec.rb +0 -91
- data/spec/modules/callbacks_spec.rb +0 -25
- data/spec/modules/email_spec.rb +0 -19
- data/spec/modules/query_interface_spec.rb +0 -93
- data/spec/modules/restrictions_spec.rb +0 -110
- data/spec/performance/performance.sh +0 -1
- data/spec/req_spec.rb +0 -29
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,9 @@
|
|
1
|
+
var _gaq = _gaq || [];
|
2
|
+
_gaq.push(['_setAccount', 'UA-36922353-1']);
|
3
|
+
_gaq.push(['_trackPageview']);
|
4
|
+
|
5
|
+
(function() {
|
6
|
+
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
7
|
+
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
8
|
+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
9
|
+
})();
|
@@ -0,0 +1,133 @@
|
|
1
|
+
userCreated = () ->
|
2
|
+
notify("user created", "label label-success")
|
3
|
+
$("#user").attr('disabled','disabled')
|
4
|
+
$("#pass").attr('disabled','disabled')
|
5
|
+
$("#signup")
|
6
|
+
.blur()
|
7
|
+
.fadeOut()
|
8
|
+
$("#extra-info").fadeIn()
|
9
|
+
|
10
|
+
userNotCreated = (jqXHR) ->
|
11
|
+
result = JSON.parse(jqXHR.responseText)
|
12
|
+
notify(result['error'], "label label-important")
|
13
|
+
|
14
|
+
reqSuccess = (data) ->
|
15
|
+
str = JSON.stringify(data, `undefined`, 2)
|
16
|
+
output = $('#parsedJson')
|
17
|
+
if (output.length > 0)
|
18
|
+
output[0].innerHTML = syntaxHighlight(str)
|
19
|
+
|
20
|
+
storageNotCreated = (jqXHR) ->
|
21
|
+
$('#parsedJson')[0].innerHTML = syntaxHighlight("{}")
|
22
|
+
|
23
|
+
signupPage = () ->
|
24
|
+
$("#user").focus()
|
25
|
+
notify("press enter to submit", "label label-info")
|
26
|
+
|
27
|
+
$("#pass").keypress (event) ->
|
28
|
+
if event.which is 13
|
29
|
+
event.preventDefault()
|
30
|
+
user = $('#user').val()
|
31
|
+
pass = $('#pass').val()
|
32
|
+
jNorthPole.createUser(user, pass, userCreated, userNotCreated)
|
33
|
+
|
34
|
+
addTryRow = (keyVal, valVal) ->
|
35
|
+
clone = $('.templateTr').clone().removeClass('templateTr')
|
36
|
+
clone.find('.templateKey').val(keyVal)
|
37
|
+
clone.find('.templateValue').val(valVal)
|
38
|
+
clearButton = clone.find('.clearButton')
|
39
|
+
clearButton.show()
|
40
|
+
clearButton.click () ->
|
41
|
+
$(this).parent().parent().remove()
|
42
|
+
$('#tryNowTable tr:last').after(clone)
|
43
|
+
$('#tryNowTable tr:last input:first').focus()
|
44
|
+
|
45
|
+
tryNowPage = () ->
|
46
|
+
npSecret = $('#tryNowTable').data('npsecret')
|
47
|
+
npGuestSecret = $('#tryNowTable').data('npguestsecret')
|
48
|
+
|
49
|
+
addTryRow(npSecret, npGuestSecret)
|
50
|
+
addTryRow('color', 'green')
|
51
|
+
|
52
|
+
$("#addTableRow").click ->
|
53
|
+
addTryRow('', '')
|
54
|
+
|
55
|
+
$("#postButton").click ->
|
56
|
+
data = getDataFromTable()
|
57
|
+
jNorthPole.createStorage(data, reqSuccess)
|
58
|
+
|
59
|
+
$("#getButton").click ->
|
60
|
+
data = getDataFromTable()
|
61
|
+
jNorthPole.getStorage(data, reqSuccess)
|
62
|
+
|
63
|
+
$("#putButton").click ->
|
64
|
+
data = getDataFromTable()
|
65
|
+
jNorthPole.putStorage(data, reqSuccess)
|
66
|
+
|
67
|
+
$("#deleteButton").click ->
|
68
|
+
data = getDataFromTable()
|
69
|
+
jNorthPole.deleteStorage(data, reqSuccess)
|
70
|
+
|
71
|
+
if typeof String::endsWith isnt "function"
|
72
|
+
String::endsWith = (suffix) ->
|
73
|
+
@indexOf(suffix, @length - suffix.length) isnt -1
|
74
|
+
|
75
|
+
window.syntaxHighlight = (json) ->
|
76
|
+
json = json.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")
|
77
|
+
json.replace /("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, (match) ->
|
78
|
+
cls = "number"
|
79
|
+
if /^"/.test(match)
|
80
|
+
if /:$/.test(match)
|
81
|
+
cls = "key"
|
82
|
+
else
|
83
|
+
cls = "string"
|
84
|
+
else if /true|false/.test(match)
|
85
|
+
cls = "boolean"
|
86
|
+
else cls = "null" if /null/.test(match)
|
87
|
+
"<span class=\"" + cls + "\">" + match + "</span>"
|
88
|
+
|
89
|
+
setActiveMenuClass = () ->
|
90
|
+
checkFor = (s) ->
|
91
|
+
if document.URL.endsWith(s)
|
92
|
+
$('.' + s).addClass('active')
|
93
|
+
|
94
|
+
checkFor 'playground'
|
95
|
+
checkFor 'examples'
|
96
|
+
|
97
|
+
randomlyFlipBear = () ->
|
98
|
+
if Math.random() > 0.5
|
99
|
+
$(".bear").toggleClass('flipit')
|
100
|
+
|
101
|
+
$(document).ready ->
|
102
|
+
setActiveMenuClass()
|
103
|
+
setInterval(randomlyFlipBear, 1000)
|
104
|
+
|
105
|
+
$('#playground').focus()
|
106
|
+
|
107
|
+
$(".dropdown-menu li a").click () ->
|
108
|
+
selText = $(this).text()
|
109
|
+
$(this).parents('.btn-group').find('.dropdown-toggle span')[0].innerHTML = selText
|
110
|
+
|
111
|
+
$('#myTab a').click (e) ->
|
112
|
+
e.preventDefault()
|
113
|
+
$(this).tab('show')
|
114
|
+
|
115
|
+
$('#npAction').click () ->
|
116
|
+
verb = $('#verb').text();
|
117
|
+
if verb == 'GET'
|
118
|
+
verb = 'SEARCH'
|
119
|
+
resource = $('#resource').text()
|
120
|
+
try
|
121
|
+
jsonObj = JSON.parse(($('#playground').val()))
|
122
|
+
catch err
|
123
|
+
reqSuccess(JSON.parse('{}'))
|
124
|
+
return 0
|
125
|
+
|
126
|
+
$.ajax
|
127
|
+
type: verb
|
128
|
+
url: "/" + resource + ".json"
|
129
|
+
data: JSON.stringify(jsonObj)
|
130
|
+
success: (data, textStatus, jqXHR) ->
|
131
|
+
reqSuccess(data)
|
132
|
+
error: (jqXHR, textstatus, errorthrown) ->
|
133
|
+
reqSuccess(JSON.parse(jqXHR.responseText))
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/*!
|
2
|
+
|
3
|
+
Holder - 2.3.1 - client side image placeholders
|
4
|
+
(c) 2012-2014 Ivan Malopinsky / http://imsky.co
|
5
|
+
|
6
|
+
Provided under the MIT License.
|
7
|
+
Commercial use requires attribution.
|
8
|
+
|
9
|
+
*/
|
10
|
+
var Holder=Holder||{};!function(a,b){function c(a,b,c){b=parseInt(b,10),a=parseInt(a,10);var d=Math.max(b,a),e=Math.min(b,a),f=1/12,g=Math.min(.75*e,.75*d*f);return{height:Math.round(Math.max(c.size,g))}}function d(a){var b=[];for(p in a)a.hasOwnProperty(p)&&b.push(p+":"+a[p]);return b.join(";")}function e(a){var b=a.ctx,d=a.dimensions,e=a.template,f=a.ratio,g=a.holder,h="literal"==g.textmode,i="exact"==g.textmode,j=c(d.width,d.height,e),k=j.height,l=d.width*f,m=d.height*f,n=e.font?e.font:"Arial,Helvetica,sans-serif";canvas.width=l,canvas.height=m,b.textAlign="center",b.textBaseline="middle",b.fillStyle=e.background,b.fillRect(0,0,l,m),b.fillStyle=e.foreground,b.font="bold "+k+"px "+n;var o=e.text?e.text:Math.floor(d.width)+"x"+Math.floor(d.height);if(h){var d=g.dimensions;o=d.width+"x"+d.height}else if(i&&g.exact_dimensions){var d=g.exact_dimensions;o=Math.floor(d.width)+"x"+Math.floor(d.height)}var p=b.measureText(o).width;return p/l>=.75&&(k=Math.floor(.75*k*(l/p))),b.font="bold "+k*f+"px "+n,b.fillText(o,l/2,m/2,l),canvas.toDataURL("image/png")}function f(a){var b=a.dimensions,d=a.template,e=a.holder,f="literal"==e.textmode,g="exact"==e.textmode,h=c(b.width,b.height,d),i=h.height,j=b.width,k=b.height,l=d.font?d.font:"Arial,Helvetica,sans-serif",m=d.text?d.text:Math.floor(b.width)+"x"+Math.floor(b.height);if(f){var b=e.dimensions;m=b.width+"x"+b.height}else if(g&&e.exact_dimensions){var b=e.exact_dimensions;m=Math.floor(b.width)+"x"+Math.floor(b.height)}var n=z({text:m,width:j,height:k,text_height:i,font:l,template:d});return"data:image/svg+xml;base64,"+btoa(n)}function g(a){return r.use_canvas&&!r.use_svg?e(a):f(a)}function h(a,b,c,d){var e=c.dimensions,f=c.theme,h=c.text?decodeURIComponent(c.text):c.text,i=e.width+"x"+e.height;f=h?o(f,{text:h}):f,f=c.font?o(f,{font:c.font}):f,b.setAttribute("data-src",d),c.theme=f,b.holder_data=c,"image"==a?(b.setAttribute("alt",h?h:f.text?f.text+" ["+i+"]":i),(r.use_fallback||!c.auto)&&(b.style.width=e.width+"px",b.style.height=e.height+"px"),r.use_fallback?b.style.backgroundColor=f.background:(b.setAttribute("src",g({ctx:w,dimensions:e,template:f,ratio:x,holder:c})),c.textmode&&"exact"==c.textmode&&(v.push(b),k(b)))):"background"==a?r.use_fallback||(b.style.backgroundImage="url("+g({ctx:w,dimensions:e,template:f,ratio:x,holder:c})+")",b.style.backgroundSize=e.width+"px "+e.height+"px"):"fluid"==a&&(b.setAttribute("alt",h?h:f.text?f.text+" ["+i+"]":i),"%"==e.height.slice(-1)?b.style.height=e.height:null!=c.auto&&c.auto||(b.style.height=e.height+"px"),"%"==e.width.slice(-1)?b.style.width=e.width:null!=c.auto&&c.auto||(b.style.width=e.width+"px"),("inline"==b.style.display||""===b.style.display||"none"==b.style.display)&&(b.style.display="block"),j(b),r.use_fallback?b.style.backgroundColor=f.background:(v.push(b),k(b)))}function i(a,b){var c={height:a.clientHeight,width:a.clientWidth};return c.height||c.width?(a.removeAttribute("data-holder-invisible"),c):(a.setAttribute("data-holder-invisible",!0),void b.call(this,a))}function j(b){if(b.holder_data){var c=i(b,a.invisible_error_fn(j));if(c){var d=b.holder_data;d.initial_dimensions=c,d.fluid_data={fluid_height:"%"==d.dimensions.height.slice(-1),fluid_width:"%"==d.dimensions.width.slice(-1),mode:null},d.fluid_data.fluid_width&&!d.fluid_data.fluid_height?(d.fluid_data.mode="width",d.fluid_data.ratio=d.initial_dimensions.width/parseFloat(d.dimensions.height)):!d.fluid_data.fluid_width&&d.fluid_data.fluid_height&&(d.fluid_data.mode="height",d.fluid_data.ratio=parseFloat(d.dimensions.width)/d.initial_dimensions.height)}}}function k(b){var c;c=null==b.nodeType?v:[b];for(var d in c)if(c.hasOwnProperty(d)){var e=c[d];if(e.holder_data){var f=e.holder_data,h=i(e,a.invisible_error_fn(k));if(h){if(f.fluid){if(f.auto)switch(f.fluid_data.mode){case"width":h.height=h.width/f.fluid_data.ratio;break;case"height":h.width=h.height*f.fluid_data.ratio}e.setAttribute("src",g({ctx:w,dimensions:h,template:f.theme,ratio:x,holder:f}))}f.textmode&&"exact"==f.textmode&&(f.exact_dimensions=h,e.setAttribute("src",g({ctx:w,dimensions:f.dimensions,template:f.theme,ratio:x,holder:f})))}}}}function l(b,c){for(var d={theme:o(y.themes.gray,{})},e=!1,f=b.length,g=0;f>g;g++){var h=b[g];a.flags.dimensions.match(h)?(e=!0,d.dimensions=a.flags.dimensions.output(h)):a.flags.fluid.match(h)?(e=!0,d.dimensions=a.flags.fluid.output(h),d.fluid=!0):a.flags.textmode.match(h)?d.textmode=a.flags.textmode.output(h):a.flags.colors.match(h)?d.theme=a.flags.colors.output(h):c.themes[h]?c.themes.hasOwnProperty(h)&&(d.theme=o(c.themes[h],{})):a.flags.font.match(h)?d.font=a.flags.font.output(h):a.flags.auto.match(h)?d.auto=!0:a.flags.text.match(h)&&(d.text=a.flags.text.output(h))}return e?d:!1}function m(a,b){var c="complete",d="readystatechange",e=!1,f=e,g=!0,h=a.document,i=h.documentElement,j=h.addEventListener?"addEventListener":"attachEvent",k=h.addEventListener?"removeEventListener":"detachEvent",l=h.addEventListener?"":"on",m=function(g){(g.type!=d||h.readyState==c)&&(("load"==g.type?a:h)[k](l+g.type,m,e),!f&&(f=!0)&&b.call(a,null))},n=function(){try{i.doScroll("left")}catch(a){return void setTimeout(n,50)}m("poll")};if(h.readyState==c)b.call(a,"lazy");else{if(h.createEventObject&&i.doScroll){try{g=!a.frameElement}catch(o){}g&&n()}h[j](l+"DOMContentLoaded",m,e),h[j](l+d,m,e),a[j](l+"load",m,e)}}function n(a,b){var a=a.match(/^(\W)?(.*)/),b=b||document,c=b["getElement"+(a[1]?"#"==a[1]?"ById":"sByClassName":"sByTagName")],d=c.call(b,a[2]),e=[];return null!==d&&(e=d.length||0===d.length?d:[d]),e}function o(a,b){var c={};for(var d in a)a.hasOwnProperty(d)&&(c[d]=a[d]);for(var d in b)b.hasOwnProperty(d)&&(c[d]=b[d]);return c}var q={use_svg:!1,use_canvas:!1,use_fallback:!1},r={},s=!1;canvas=document.createElement("canvas");var t=1,u=1,v=[];if(canvas.getContext)if(canvas.toDataURL("image/png").indexOf("data:image/png")<0)q.use_fallback=!0;else var w=canvas.getContext("2d");else q.use_fallback=!0;document.createElementNS&&document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect&&(q.use_svg=!0,q.use_canvas=!1),q.use_fallback||(t=window.devicePixelRatio||1,u=w.webkitBackingStorePixelRatio||w.mozBackingStorePixelRatio||w.msBackingStorePixelRatio||w.oBackingStorePixelRatio||w.backingStorePixelRatio||1);var x=t/u,y={domain:"holder.js",images:"img",bgnodes:".holderjs",themes:{gray:{background:"#eee",foreground:"#aaa",size:12},social:{background:"#3a5a97",foreground:"#fff",size:12},industrial:{background:"#434A52",foreground:"#C2F200",size:12},sky:{background:"#0D8FDB",foreground:"#fff",size:12},vine:{background:"#39DBAC",foreground:"#1E292C",size:12},lava:{background:"#F8591A",foreground:"#1C2846",size:12}},stylesheet:""};a.flags={dimensions:{regex:/^(\d+)x(\d+)$/,output:function(a){var b=this.regex.exec(a);return{width:+b[1],height:+b[2]}}},fluid:{regex:/^([0-9%]+)x([0-9%]+)$/,output:function(a){var b=this.regex.exec(a);return{width:b[1],height:b[2]}}},colors:{regex:/#([0-9a-f]{3,})\:#([0-9a-f]{3,})/i,output:function(a){var b=this.regex.exec(a);return{size:y.themes.gray.size,foreground:"#"+b[2],background:"#"+b[1]}}},text:{regex:/text\:(.*)/,output:function(a){return this.regex.exec(a)[1]}},font:{regex:/font\:(.*)/,output:function(a){return this.regex.exec(a)[1]}},auto:{regex:/^auto$/},textmode:{regex:/textmode\:(.*)/,output:function(a){return this.regex.exec(a)[1]}}};var z=function(){if(window.XMLSerializer){var a=new XMLSerializer,b="http://www.w3.org/2000/svg",c=document.createElementNS(b,"svg");c.webkitMatchesSelector&&c.setAttribute("xmlns","http://www.w3.org/2000/svg");var e=document.createElementNS(b,"rect"),f=document.createElementNS(b,"text"),g=document.createTextNode(null);return f.setAttribute("text-anchor","middle"),f.appendChild(g),c.appendChild(e),c.appendChild(f),function(b){return c.setAttribute("width",b.width),c.setAttribute("height",b.height),e.setAttribute("width",b.width),e.setAttribute("height",b.height),e.setAttribute("fill",b.template.background),f.setAttribute("x",b.width/2),f.setAttribute("y",b.height/2),g.nodeValue=b.text,f.setAttribute("style",d({fill:b.template.foreground,"font-weight":"bold","font-size":b.text_height+"px","font-family":b.font,"dominant-baseline":"central"})),a.serializeToString(c)}}}();for(var A in a.flags)a.flags.hasOwnProperty(A)&&(a.flags[A].match=function(a){return a.match(this.regex)});a.invisible_error_fn=function(){return function(a){if(a.hasAttribute("data-holder-invisible"))throw new Error("Holder: invisible placeholder")}},a.add_theme=function(b,c){return null!=b&&null!=c&&(y.themes[b]=c),a},a.add_image=function(b,c){var d=n(c);if(d.length)for(var e=0,f=d.length;f>e;e++){var g=document.createElement("img");g.setAttribute("data-src",b),d[e].appendChild(g)}return a},a.run=function(b){r=o({},q),s=!0;var c=o(y,b),d=[],e=[],f=[];for(null!=c.use_canvas&&c.use_canvas&&(r.use_canvas=!0,r.use_svg=!1),"string"==typeof c.images?e=n(c.images):window.NodeList&&c.images instanceof window.NodeList?e=c.images:window.Node&&c.images instanceof window.Node?e=[c.images]:window.HTMLCollection&&c.images instanceof window.HTMLCollection&&(e=c.images),"string"==typeof c.bgnodes?f=n(c.bgnodes):window.NodeList&&c.elements instanceof window.NodeList?f=c.bgnodes:window.Node&&c.bgnodes instanceof window.Node&&(f=[c.bgnodes]),k=0,j=e.length;j>k;k++)d.push(e[k]);var g=document.getElementById("holderjs-style");g||(g=document.createElement("style"),g.setAttribute("id","holderjs-style"),g.type="text/css",document.getElementsByTagName("head")[0].appendChild(g)),c.nocss||(g.styleSheet?g.styleSheet.cssText+=c.stylesheet:g.appendChild(document.createTextNode(c.stylesheet)));for(var i=new RegExp(c.domain+'/(.*?)"?\\)'),j=f.length,k=0;j>k;k++){var m=window.getComputedStyle(f[k],null).getPropertyValue("background-image"),p=m.match(i),t=f[k].getAttribute("data-background-src");if(p){var u=l(p[1].split("/"),c);u&&h("background",f[k],u,m)}else if(null!=t){var u=l(t.substr(t.lastIndexOf(c.domain)+c.domain.length+1).split("/"),c);u&&h("background",f[k],u,m)}}for(j=d.length,k=0;j>k;k++){var v,w;w=v=m=null;try{w=d[k].getAttribute("src"),attr_datasrc=d[k].getAttribute("data-src")}catch(x){}if(null==attr_datasrc&&w&&w.indexOf(c.domain)>=0?m=w:attr_datasrc&&attr_datasrc.indexOf(c.domain)>=0&&(m=attr_datasrc),m){var u=l(m.substr(m.lastIndexOf(c.domain)+c.domain.length+1).split("/"),c);u&&(u.fluid?h("fluid",d[k],u,m):h("image",d[k],u,m))}}return a},m(b,function(){window.addEventListener?(window.addEventListener("resize",k,!1),window.addEventListener("orientationchange",k,!1)):window.attachEvent("onresize",k),s||a.run({})}),"function"==typeof define&&define.amd&&define([],function(){return a}),function(){function a(a){this.message=a}var b="undefined"!=typeof exports?exports:this,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";a.prototype=Error(),a.prototype.name="InvalidCharacterError",b.btoa||(b.btoa=function(b){for(var d,e,f=0,g=c,h="";b.charAt(0|f)||(g="=",f%1);h+=g.charAt(63&d>>8-8*(f%1))){if(e=b.charCodeAt(f+=.75),e>255)throw new a("'btoa' failed");d=d<<8|e}return h}),b.atob||(b.atob=function(b){if(b=b.replace(/=+$/,""),1==b.length%4)throw new a("'atob' failed");for(var d,e,f=0,g=0,h="";e=b.charAt(g++);~e&&(d=f%4?64*d+e:e,f++%4)?h+=String.fromCharCode(255&d>>(6&-2*f)):0)e=c.indexOf(e);return h})}(),document.getElementsByClassName||(document.getElementsByClassName=function(a){var b,c,d,e=document,f=[];if(e.querySelectorAll)return e.querySelectorAll("."+a);if(e.evaluate)for(c=".//*[contains(concat(' ', @class, ' '), ' "+a+" ')]",b=e.evaluate(c,e,null,0,null);d=b.iterateNext();)f.push(d);else for(b=e.getElementsByTagName("*"),c=new RegExp("(^|\\s)"+a+"(\\s|$)"),d=0;d<b.length;d++)c.test(b[d].className)&&f.push(b[d]);return f}),window.getComputedStyle||(window.getComputedStyle=function(a){return this.el=a,this.getPropertyValue=function(b){var c=/(\-([a-z]){1})/g;return"float"==b&&(b="styleFloat"),c.test(b)&&(b=b.replace(c,function(){return arguments[2].toUpperCase()})),a.currentStyle[b]?a.currentStyle[b]:null},this}),Object.prototype.hasOwnProperty||(Object.prototype.hasOwnProperty=function(a){var b=this.__proto__||this.constructor.prototype;return a in this&&(!(a in b)||b[a]!==this[a])})}(Holder,window),/*!
|
11
|
+
* JavaScript for Bootstrap's docs (http://getbootstrap.com)
|
12
|
+
* Copyright 2011-2014 Twitter, Inc.
|
13
|
+
* Licensed under the Creative Commons Attribution 3.0 Unported License. For
|
14
|
+
* details, see http://creativecommons.org/licenses/by/3.0/.
|
15
|
+
*/
|
16
|
+
!function(a){a(function(){if(navigator.userAgent.match(/IEMobile\/10\.0/)){var b=document.createElement("style");b.appendChild(document.createTextNode("@-ms-viewport{width:auto!important}")),document.querySelector("head").appendChild(b)}{var c=a(window),d=a(document.body);a(".navbar").outerHeight(!0)+10}d.scrollspy({target:".bs-docs-sidebar"}),c.on("load",function(){d.scrollspy("refresh")}),a(".bs-docs-container [href=#]").click(function(a){a.preventDefault()}),setTimeout(function(){var b=a(".bs-docs-sidebar");b.affix({offset:{top:function(){var c=b.offset().top,d=parseInt(b.children(0).css("margin-top"),10),e=a(".bs-docs-nav").height();return this.top=c-e-d},bottom:function(){return this.bottom=a(".bs-docs-footer").outerHeight(!0)}}})},100),setTimeout(function(){a(".bs-top").affix()},100),a(".tooltip-demo").tooltip({selector:"[data-toggle=tooltip]",container:"body"}),a(".tooltip-test").tooltip(),a(".popover-test").popover(),a(".bs-docs-navbar").tooltip({selector:"a[data-toggle=tooltip]",container:".bs-docs-navbar .nav"}),a("[data-toggle=popover]").popover(),a("#loading-example-btn").click(function(){var b=a(this);b.button("loading"),setTimeout(function(){b.button("reset")},3e3)})})}(jQuery);
|
@@ -0,0 +1,34 @@
|
|
1
|
+
window.jNorthPole =
|
2
|
+
root: Math.sqrt,
|
3
|
+
square: (x) -> x * x,
|
4
|
+
cube: (x) -> x * this.square x,
|
5
|
+
createUser: (api_key, secret, success, failer) ->
|
6
|
+
jsonObj = {'api_key': api_key, 'secret': secret}
|
7
|
+
$.ajax
|
8
|
+
type: "POST"
|
9
|
+
url: "/user.json"
|
10
|
+
data: JSON.stringify(jsonObj)
|
11
|
+
success: (data, textStatus, jqXHR) ->
|
12
|
+
success()
|
13
|
+
error: (jqXHR, textstatus, errorthrown) ->
|
14
|
+
failer(jqXHR)
|
15
|
+
genericRequest: (jsonObj, method, responseHandler) ->
|
16
|
+
$.ajax
|
17
|
+
type: method
|
18
|
+
url: "/storage.json"
|
19
|
+
data: JSON.stringify(jsonObj)
|
20
|
+
success: (data, textStatus, jqXHR) ->
|
21
|
+
responseHandler(data)
|
22
|
+
error: (jqXHR, textstatus, errorthrown) ->
|
23
|
+
console.log(jqXHR.responseText)
|
24
|
+
responseHandler(JSON.parse(jqXHR.responseText))
|
25
|
+
createStorage: (jsonObj, responseHandler) ->
|
26
|
+
this.genericRequest(jsonObj, 'POST', responseHandler)
|
27
|
+
putStorage: (jsonObj, responseHandler) ->
|
28
|
+
this.genericRequest(jsonObj, 'PUT', responseHandler)
|
29
|
+
getStorage: (jsonObj, responseHandler) ->
|
30
|
+
this.genericRequest(jsonObj, 'SEARCH', responseHandler)
|
31
|
+
deleteStorage: (jsonObj, responseHandler) ->
|
32
|
+
this.genericRequest(jsonObj, 'DELETE', responseHandler)
|
33
|
+
getUrl: (id) ->
|
34
|
+
"http://localhost:9292/storage.json?id=" + id
|
@@ -0,0 +1,31 @@
|
|
1
|
+
window.notify = (text, label) ->
|
2
|
+
$("#signup-info")
|
3
|
+
.text(text)
|
4
|
+
.removeClass()
|
5
|
+
.addClass(label)
|
6
|
+
|
7
|
+
window.syntaxHighlight = (json) ->
|
8
|
+
json = json.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")
|
9
|
+
json.replace /("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, (match) ->
|
10
|
+
cls = "number"
|
11
|
+
if /^"/.test(match)
|
12
|
+
if /:$/.test(match)
|
13
|
+
cls = "key"
|
14
|
+
else
|
15
|
+
cls = "string"
|
16
|
+
else if /true|false/.test(match)
|
17
|
+
cls = "boolean"
|
18
|
+
else cls = "null" if /null/.test(match)
|
19
|
+
"<span class=\"" + cls + "\">" + match + "</span>"
|
20
|
+
|
21
|
+
window.getDataFromTable = () ->
|
22
|
+
obj = {}
|
23
|
+
# :gt(0) skips the header
|
24
|
+
$('#tryNowTable tr:gt(0)').each (index) ->
|
25
|
+
elements = $(this).find('input');
|
26
|
+
key = $(elements[0]).val()
|
27
|
+
val = $(elements[1]).val()
|
28
|
+
if (key != '' && val != '')
|
29
|
+
obj[key]=val
|
30
|
+
obj
|
31
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
body
|
2
|
+
padding-top: 20px
|
3
|
+
padding-bottom: 20px
|
4
|
+
|
5
|
+
.navbar
|
6
|
+
margin-bottom: 20px
|
7
|
+
|
8
|
+
.tab-content
|
9
|
+
padding-top: 10px
|
10
|
+
|
11
|
+
.flipit
|
12
|
+
-moz-transform: scaleX(-1)
|
13
|
+
-o-transform: scaleX(-1)
|
14
|
+
-webkit-transform: scaleX(-1)
|
15
|
+
transform: scaleX(-1)
|
16
|
+
filter: FlipH
|
17
|
+
-ms-filter: "FlipH"
|
18
|
+
|
19
|
+
.bear
|
20
|
+
margin: auto
|
21
|
+
|
22
|
+
.code
|
23
|
+
text-align: justify
|
@@ -0,0 +1,222 @@
|
|
1
|
+
$sky-dark: #a1caf6
|
2
|
+
$sky-light: #bfe1fa
|
3
|
+
$snow: #e4f2fd
|
4
|
+
$ground: #6e8b8f
|
5
|
+
$under-ground: #45645e
|
6
|
+
|
7
|
+
@mixin square
|
8
|
+
border-radius: 0px
|
9
|
+
-mox-border-radius: 0px
|
10
|
+
-webkit-border-radius: 0px
|
11
|
+
|
12
|
+
@mixin noshadow
|
13
|
+
box-shadow: none
|
14
|
+
text-shadow: none
|
15
|
+
-moz-box-shadow: none
|
16
|
+
-webkit-box-shadow: none
|
17
|
+
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false)
|
18
|
+
transition: none
|
19
|
+
-moz-transition: none
|
20
|
+
-webkit-box-transition: none
|
21
|
+
|
22
|
+
@mixin handy
|
23
|
+
cursor: pointer
|
24
|
+
cursor: hand
|
25
|
+
|
26
|
+
html, body
|
27
|
+
height: 100%
|
28
|
+
color: $under-ground
|
29
|
+
|
30
|
+
.justify
|
31
|
+
text-align: justify
|
32
|
+
|
33
|
+
.right
|
34
|
+
text-align: right
|
35
|
+
|
36
|
+
a:hover
|
37
|
+
text-decoration: none
|
38
|
+
|
39
|
+
.language:hover
|
40
|
+
text-decoration: none
|
41
|
+
|
42
|
+
.wrapper
|
43
|
+
min-height: 100%
|
44
|
+
background: url('/images/bg.png') top center repeat-x
|
45
|
+
position: relative
|
46
|
+
|
47
|
+
.container-fluid
|
48
|
+
padding-left: 150px
|
49
|
+
padding-right: 150px
|
50
|
+
|
51
|
+
.bear
|
52
|
+
position: relative
|
53
|
+
top: -150px
|
54
|
+
|
55
|
+
.flipit
|
56
|
+
-moz-transform: scaleX(-1)
|
57
|
+
-o-transform: scaleX(-1)
|
58
|
+
-webkit-transform: scaleX(-1)
|
59
|
+
transform: scaleX(-1)
|
60
|
+
filter: FlipH
|
61
|
+
-ms-filter: "FlipH"
|
62
|
+
|
63
|
+
.italic
|
64
|
+
font-style: italic
|
65
|
+
|
66
|
+
legend
|
67
|
+
color: $under-ground
|
68
|
+
|
69
|
+
.all-content
|
70
|
+
padding-top: 60px
|
71
|
+
|
72
|
+
.bear-content
|
73
|
+
text-align: center
|
74
|
+
|
75
|
+
.ruby:hover
|
76
|
+
background-image: url('/images/ruby_small.png')
|
77
|
+
|
78
|
+
.python:hover
|
79
|
+
background-image: url('/images/python_small.png')
|
80
|
+
|
81
|
+
.php:hover
|
82
|
+
background-image: url('/images/php_small.png')
|
83
|
+
|
84
|
+
.java:hover
|
85
|
+
background-image: url('/images/java_small.png')
|
86
|
+
|
87
|
+
.shell:hover
|
88
|
+
background-image: url('/images/shell_small.png')
|
89
|
+
|
90
|
+
.json:hover
|
91
|
+
background-image: url('/images/json_small.png')
|
92
|
+
|
93
|
+
.dotnet:hover
|
94
|
+
background-image: url('/images/dotnet_small.png')
|
95
|
+
|
96
|
+
.label-info
|
97
|
+
background-color: $ground
|
98
|
+
|
99
|
+
.hero-unit
|
100
|
+
@include square
|
101
|
+
margin-bottom: 80px
|
102
|
+
background-color: white
|
103
|
+
|
104
|
+
#storageEndpoint
|
105
|
+
display: none
|
106
|
+
|
107
|
+
.index-page-wrapper
|
108
|
+
.row-fluid
|
109
|
+
.span4
|
110
|
+
h3
|
111
|
+
text-align: center
|
112
|
+
p
|
113
|
+
text-align: center
|
114
|
+
|
115
|
+
pre.code, .badge, .label
|
116
|
+
@include square
|
117
|
+
|
118
|
+
input[type=text], textarea
|
119
|
+
@include square
|
120
|
+
&:focus
|
121
|
+
@include noshadow
|
122
|
+
border-color: #cccccc
|
123
|
+
|
124
|
+
i
|
125
|
+
font-size: 28px
|
126
|
+
color: $under-ground
|
127
|
+
|
128
|
+
.btn
|
129
|
+
@include square
|
130
|
+
@include noshadow
|
131
|
+
background-image: none
|
132
|
+
border: 0
|
133
|
+
background-color: $ground
|
134
|
+
color: $snow
|
135
|
+
&:hover
|
136
|
+
background-color: $ground
|
137
|
+
color: $snow
|
138
|
+
|
139
|
+
pre.code
|
140
|
+
background-repeat: no-repeat
|
141
|
+
background-position: right top
|
142
|
+
|
143
|
+
h3
|
144
|
+
a
|
145
|
+
color: $under-ground
|
146
|
+
&:hover
|
147
|
+
color: $under-ground
|
148
|
+
|
149
|
+
#tryNowTable
|
150
|
+
margin-bottom: 0px
|
151
|
+
input
|
152
|
+
width: 100%
|
153
|
+
padding: 2px
|
154
|
+
i
|
155
|
+
font-size: 18px
|
156
|
+
@include handy
|
157
|
+
.clearButton
|
158
|
+
display: none
|
159
|
+
height: 10px
|
160
|
+
|
161
|
+
#addTableRow
|
162
|
+
@include handy
|
163
|
+
|
164
|
+
pre
|
165
|
+
padding: 5px
|
166
|
+
@include square
|
167
|
+
@include noshadow
|
168
|
+
|
169
|
+
.string
|
170
|
+
color: green
|
171
|
+
|
172
|
+
.number
|
173
|
+
color: darkorange
|
174
|
+
|
175
|
+
.boolean
|
176
|
+
color: blue
|
177
|
+
|
178
|
+
.null
|
179
|
+
color: magenta
|
180
|
+
|
181
|
+
.key
|
182
|
+
color: red
|
183
|
+
|
184
|
+
#header
|
185
|
+
padding-top: 130px
|
186
|
+
height: 200px
|
187
|
+
div
|
188
|
+
text-align: center
|
189
|
+
width: 100%
|
190
|
+
background-color: $ground
|
191
|
+
padding-top: 5px
|
192
|
+
padding-bottom: 5px
|
193
|
+
a
|
194
|
+
color: $snow
|
195
|
+
p
|
196
|
+
color: $snow
|
197
|
+
font-weight: bold
|
198
|
+
a:hover
|
199
|
+
text-decoration: none
|
200
|
+
|
201
|
+
#footer
|
202
|
+
position: absolute
|
203
|
+
bottom: 0px
|
204
|
+
left: 0px
|
205
|
+
background-color: $under-ground
|
206
|
+
background-image: url(/images/footer.png)
|
207
|
+
background-repeat: repeat-x
|
208
|
+
div
|
209
|
+
div
|
210
|
+
text-align: center
|
211
|
+
dl
|
212
|
+
position: relative
|
213
|
+
dd
|
214
|
+
padding-top: 3px
|
215
|
+
dd, p, h3, a, div
|
216
|
+
color: $snow
|
217
|
+
.span8
|
218
|
+
padding-left: 90px
|
219
|
+
|
220
|
+
@media (max-width: 767px)
|
221
|
+
.bear-content
|
222
|
+
visibility: hidden
|