- JavaScript
- JSFiddle (https://jsfiddle.net/)
- CodePen (https://codepen.io/)
- JS Bin (https://jsbin.com/)
- HTML/CSS
- JSFiddle (https://jsfiddle.net/)
- CodePen (https://codepen.io/)
- JS Bin (https://jsbin.com/)
- SQL
- SQL Fiddle (http://sqlfiddle.com/)
# Requirements | |
- 2x Resistors (10K) | |
- 2x Transistors (S8050) | |
- USB to UART Module | |
- ESP32 |
#!/bin/bash | |
#apt-get update | |
#apt-get upgrade -y | |
apt-get install build-essential |
% node --print-bytecode --print-bytecode-filter=testFor scenarios/bytecode/benchmark.js | |
[generated bytecode for function: testFor] | |
Parameter count 2 | |
Frame size 16 | |
78 E> 0x596d72600ba @ 0 : a0 StackCheck | |
96 S> 0x596d72600bb @ 1 : 0c 0a LdaSmi [10] | |
0x596d72600bd @ 3 : 26 fb Star r0 | |
102 E> 0x596d72600bf @ 5 : a0 StackCheck | |
116 S> 0x596d72600c0 @ 6 : 25 fb Ldar r0 | |
0x596d72600c2 @ 8 : 73 00 ToNumeric [0] |
function testFor(obj) { | |
let i = 10 | |
for(;;) { | |
if (i-- === 0) | |
return true | |
} | |
} | |
function testWhile(obj) { |
module.exports.scenario = function() { | |
let runCycles = totalExecutionLimit // 1,000,000,000 | |
setInitialTime() | |
while (true) { | |
// do the calculation | |
add(2, 2) | |
if (!runCycles--) | |
break |
module.exports.scenario = function() { | |
let runCycles = totalExecutionLimit // 1,000,000,000 | |
setInitialTime() | |
for (;;) { | |
// do the calculation | |
add(2, 2) | |
if (!runCycles--) | |
break |
module.exports.add = function(a, b) { | |
return a + b | |
} |
2.hours.ago # => Fri, 02 Mar 2012 20:04:47 JST +09:00 | |
1.day.from_now # => Fri, 03 Mar 2012 22:04:47 JST +09:00 | |
Date.today.to_time_in_current_zone # => Fri, 02 Mar 2012 22:04:47 JST +09:00 | |
Date.current # => Fri, 02 Mar | |
Time.zone.parse("2012-03-02 16:05:37") # => Fri, 02 Mar 2012 16:05:37 JST +09:00 | |
Time.zone.now # => Fri, 02 Mar 2012 22:04:47 JST +09:00 | |
Time.current # Same thing but shorter. (Thank you Lukas Sarnacki pointing this out.) | |
Time.zone.today # If you really can't have a Time or DateTime for some reason | |
Time.zone.now.utc.iso8601 # When supliyng an API (you can actually skip .zone here, but I find it better to always use it, than miss it when it's needed) | |
Time.strptime(time_string, '%Y-%m-%dT%H:%M:%S%z').in_time_zone(Time.zone) # If you can't use Time#parse |
window.startLiking = true | |
function getRandomArbitrary(min, max) { | |
return Math.random() * (max - min) + min; | |
} | |
function getRandomTime(min, max) { | |
return Math.floor(Math.random() * (max - min + 1)) + min; | |
} |