mirror of
https://github.com/moparisthebest/android.moparisthebest.org
synced 2024-10-31 23:35:00 -04:00
added files for documentation on include_code
This commit is contained in:
parent
2ff46f3711
commit
1e26b77a0d
20
source/downloads/code/ruby/test.rb
Normal file
20
source/downloads/code/ruby/test.rb
Normal file
@ -0,0 +1,20 @@
|
||||
class Float
|
||||
def number_decimal_places
|
||||
self.to_s.length-2
|
||||
end
|
||||
def to_fraction
|
||||
higher = 10**self.number_decimal_places
|
||||
lower = self*higher
|
||||
gcden = greatest_common_divisor(higher, lower)
|
||||
|
||||
return (lower/gcden).round, (higher/gcden).round
|
||||
end
|
||||
|
||||
private
|
||||
def greatest_common_divisor(a, b)
|
||||
while a%b != 0
|
||||
a,b = b.round,(a%b).round
|
||||
end
|
||||
return b
|
||||
end
|
||||
end
|
8
source/downloads/code/test.coffee
Normal file
8
source/downloads/code/test.coffee
Normal file
@ -0,0 +1,8 @@
|
||||
fibonacci = (n) ->
|
||||
if n <= 2
|
||||
n
|
||||
else
|
||||
arguments.callee(n - 2) + arguments.callee(n - 1)
|
||||
|
||||
for x in [1..10]
|
||||
console.log "#{x} : #{fibonacci(x)}"
|
20
source/downloads/code/test.js
Normal file
20
source/downloads/code/test.js
Normal file
@ -0,0 +1,20 @@
|
||||
/**
|
||||
sample javascript from xui
|
||||
*/
|
||||
|
||||
var undefined,
|
||||
xui,
|
||||
window = this,
|
||||
string = new String('string'),
|
||||
document = window.document,
|
||||
simpleExpr = /^#?([\w-]+)$/,
|
||||
idExpr = /^#/,
|
||||
tagExpr = /<([\w:]+)/,
|
||||
slice = function (e) { return [].slice.call(e, 0); };
|
||||
try { var a = slice(document.documentElement.childNodes)[0].nodeType; }
|
||||
catch(e){ slice = function (e) { var ret=[]; for (var i=0; e[i]; i++)
|
||||
ret.push(e[i]); return ret; }; }
|
||||
|
||||
window.x$ = window.xui = xui = function(q, context) {
|
||||
return new xui.fn.find(q, context);
|
||||
};
|
Loading…
Reference in New Issue
Block a user