Syntax highlighting
Highlight code using highlight.js , syntax highlighting for the web. For more information click here.
HTML
<div class="container-fluid">
<div class="row m-b-20">
<div class="col-md-1">.col-md-1</div>
<div class="col-md-1">.col-md-1</div>
<div class="col-md-1">.col-md-1</div>
<div class="col-md-1">.col-md-1</div>
<div class="col-md-1">.col-md-1</div>
<div class="col-md-1">.col-md-1</div>
<div class="col-md-1">.col-md-1</div>
<div class="col-md-1">.col-md-1</div>
<div class="col-md-1">.col-md-1</div>
<div class="col-md-1">.col-md-1</div>
<div class="col-md-1">.col-md-1</div>
<div class="col-md-1">.col-md-1</div>
</div>
</div>
Ruby
i = 0
numbers = []
while i < 6
puts "At the top i is #{i}"
numbers.push(i)
i += 1
puts " Numbers now: ", numbers
puts "At the bottom i is #{i}"
end
puts "The numbers: " # remember you can write this 2 other ways?
numbers.each {
|num| puts num
}
Javascript
const fs = require('fs'); fs.unlinkSync('/tmp/hello');
console.log('successfully deleted /tmp/hello');
fs.rename('/tmp/hello', '/tmp/world', (err) => {
if (err)
throw m-b-20 err;
console.log('renamed complete');
});
fs.stat('/tmp/world', (err, stats) => {
if (err)
throw m-b-20 err;
console.log(`stats: ${ON.stringify(stats)}`);
});
PHP
<?php class Idea extends Angular { /**
* Dreaming of something interesting?
*
* @with Angular and PHP
*/
public function create()
{
echo "Hello world!";
}
}
Python
def fib(n):
a, b = 0, 1
while a < n:
print(a, end=' ')
a, b = b, a + b
print('')
fib(1000)
.b-w-0 {
border-width: 0px;
}
.b-w-1 {
border-width: 1px;
}
.b-w-2 {
border-width: 2px;
}
Java
public class Java {
public static void main(String[] args) {
System.out.println("Hello World");
}
}