This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SQRT_5 = Math.sqrt(5) | |
| GOLDEN_NUMBER = (1+SQRT_5)/2 | |
| def fib(n) | |
| (1/SQRT_5*(GOLDEN_NUMBER**n-(-1/GOLDEN_NUMBER)**n)).to_i | |
| end | |
| puts fib(7) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Robot = function(robot){ | |
| robot.turnLeft(robot.angle % 90); | |
| }; | |
| Robot.prototype.onIdle = function(ev) { | |
| var robot = ev.robot; | |
| if (robot.parentId) { | |
| robot.ahead(1); | |
| robot.turnGunRight(1); | |
| } | |
| else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Robot = function(robot){ | |
| robot.turnLeft(robot.angle % 90); | |
| }; | |
| Robot.prototype.onIdle = function(ev) { | |
| var robot = ev.robot; | |
| if (robot.parentId) { | |
| robot.ahead(1); | |
| robot.turnGunRight(1); | |
| } | |
| else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - load bootstrap_toolkit | |
| != form|as_bootstrap |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pyjade.ext.html import HTMLCompiler | |
| from pyjade.utils import process | |
| plantilla = "h1= titulo" | |
| contexto = {"titulo": "Titulo principal"} | |
| def compilar(plantilla, contexto): | |
| compiler = HTMLCompiler | |
| compiler.global_context = contexto | |
| return process(plantilla,compiler=compiler) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >> A = [1 0 0; 0 1 0; 0 0 1; 1 -1 0; 1 0 -1; 0 1 -1;] | |
| A = | |
| 1 0 0 | |
| 0 1 0 | |
| 0 0 1 | |
| 1 -1 0 | |
| 1 0 -1 | |
| 0 1 -1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function [t,y]=carga(fichero) | |
| [t,y] = textread(fichero, '%f %f'); | |
| t = t'; | |
| y = y'; | |
| end |
NewerOlder