Skip to content

Commit aba1ee5

Browse files
authored
Added some examples
1 parent dd27e1c commit aba1ee5

File tree

7 files changed

+114
-2
lines changed

7 files changed

+114
-2
lines changed

InfiniteLoop.java

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import java.util.ArrayList;
2+
import java.util.Vector;
3+
4+
public class InfiniteLoop {
5+
6+
/*
7+
* This will cause the program to hang...
8+
*
9+
* Taken from:
10+
* http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/
11+
*/
12+
public static void main(String[] args) {
13+
double d = Double.parseDouble("2.2250738585072012e-308");
14+
15+
// unreachable code
16+
System.out.println("Value: " + d);
17+
}
18+
}

Javascript.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function foo(items, nada) {
2+
for (var i=0; i<items.length; i++) {
3+
alert(items[i] + "juhu\n");
4+
} // Real Tab.
5+
}

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
# example-git-repository
2-
example-git-repository
1+
# Example Git Repository
2+
3+
This is an example repository to see how GitGui works.

example.sql

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
create table t (
2+
id integer,
3+
month varchar(3),
4+
value integer
5+
);
6+
7+
insert into t (month, value) values ('jan', 1);
8+
insert into t (month, value) values ('jan', 1);
9+
insert into t (month, value) values ('oct', 3);
10+
insert into t (month, value) values ('dec', 96);
11+
12+
13+
select * from (select month, value from t)
14+
pivot
15+
(
16+
sum(value)
17+
for month in ('jan', 'oct', 'dec')
18+
);

index.html

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
5+
<style type="text/css">
6+
.text-layer {
7+
font-family: Monaco, "Courier New", monospace;
8+
font-size: 12px;
9+
cursor: text;
10+
}
11+
</style>
12+
13+
</head>
14+
<body>
15+
<h1 style="color:red">Juhu Kinners</h1>
16+
</body>
17+
</html>

index.php

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
function nfact($n) {
4+
if ($n == 0) {
5+
return 1;
6+
}
7+
else {
8+
return $n * nfact($n - 1);
9+
}
10+
}
11+
12+
echo "\n\nPlease enter a whole number ... ";
13+
$num = trim(fgets(STDIN));
14+
15+
// ===== PROCESS - Determing the factorial of the input number =====
16+
$output = "\n\nFactorial " . $num . " = " . nfact($num) . "\n\n";
17+
echo $output;
18+
19+
?>

main.go

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Concurrent computation of pi.
2+
// See http://goo.gl/ZuTZM.
3+
//
4+
// This demonstrates Go's ability to handle
5+
// large numbers of concurrent processes.
6+
// It is an unreasonable way to calculate pi.
7+
package main
8+
9+
import (
10+
"fmt"
11+
"math"
12+
)
13+
14+
func main() {
15+
fmt.Println(pi(5000))
16+
}
17+
18+
// pi launches n goroutines to compute an
19+
// approximation of pi.
20+
func pi(n int) float64 {
21+
ch := make(chan float64)
22+
for k := 0; k <= n; k++ {
23+
go term(ch, float64(k))
24+
}
25+
f := 0.0
26+
for k := 0; k <= n; k++ {
27+
f += <-ch
28+
}
29+
return f
30+
}
31+
32+
func term(ch chan float64, k float64) {
33+
ch <- 4 * math.Pow(-1, k) / (2*k + 1)
34+
}

0 commit comments

Comments
 (0)