Skip to content

Instantly share code, notes, and snippets.

@betaveros
Created October 28, 2014 11:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save betaveros/48588f5443ea664e3912 to your computer and use it in GitHub Desktop.
Save betaveros/48588f5443ea664e3912 to your computer and use it in GitHub Desktop.
Sample BBCode syntax-highlighted code snippets
CSS Tag
[css]body #container .hello:before {
content: "Hello, world!";
border: 10px solid black;
}[/css]
C Tag
[c]#include <stdio.h>
int main(void) {
if (2 + 2 == 4) {
printf("Hello, world!\n");
}
return 0;
}[/c]
C++ Tag
[cpp]#include <iostream>
using namespace std;
int main() {
if (2 + 2 == 4) {
cout << "Hello, world!" << endl;
}
return 0;
}[/cpp]
Haskell Tag
[haskell]import Control.Monad
main :: IO ()
main = when (2 + 2 == 4) $ putStrLn "Hello, world!"[/haskell]
HTML Tag
[html]<!DOCTYPE html>
<html lang="en">
<body>
<p>Hello, world!</p>
</body>
</html>[/html]
Java Tag
[java]public class HelloWorld {
public static void main(String[] args) {
if (2 + 2 == 4) {
System.out.println("Hello, world!");
}
}
}[/java]
JavaScript Tag
[js]if (2 + 2 == 4) {
console.log('Hello, world!');
}[/js]
Python Tag
[python]if __name__ == "__main__" and 2 + 2 == 4:
print "Hello, world!"[/python]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment