This file contains 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
<?php | |
file_put_contents(__DIR__ . '/test.txt', "Hello World"); | |
?> |
This file contains 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
// Only scalar values, both for parameters and return values. | |
// Calculation must be split into 2 methods. Ugly code, duplicate calculations. | |
public final class VectorMath { | |
public static double getRotatedX(final double x, final double y, | |
final double angle) { | |
return x * Math.cos(angle) - y * Math.sin(angle); | |
} | |
This file contains 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
import java.awt.BorderLayout; | |
import java.awt.Color; | |
import java.awt.Component; | |
import java.awt.Dimension; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
import java.awt.event.MouseEvent; | |
import java.awt.event.MouseMotionAdapter; | |
import javax.swing.Box; |
This file contains 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
Running Ball Drop | |
Ball Drop (10 steps, 10 solve loops) : 27 ms (370.3703703703704 steps/second) | |
Checksum: -1.8194444444444444 | |
Ball Drop (10 steps, 30 solve loops) : 10 ms (1000.0 steps/second) | |
Checksum: -1.8194444444444444 | |
Ball Drop (100 steps, 10 solve loops) : 39 ms (2564.102564102564 steps/second) | |
Checksum: -30.69444444444442 |
This file contains 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
Running Ball Drop | |
Ball Drop (10 steps, 10 solve loops) : 23 ms (434.7826086956522 steps/second) | |
Checksum: -1.8194442838430405 | |
Ball Drop (10 steps, 30 solve loops) : 9 ms (1111.111111111111 steps/second) | |
Checksum: -1.8194442838430405 | |
Ball Drop (100 steps, 10 solve loops) : 42 ms (2380.9523809523807 steps/second) | |
Checksum: -30.694456100463867 |
This file contains 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
#lang racket | |
(define (anfangskurs A B D) | |
(define alpha (my-acos (/ (- (sin B) (* (cos D) (sin A))) (* (cos A) (sin D))))) | |
(cond | |
[(< 180 alpha) (- 360 alpha) alpha])) |
This file contains 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
#lang racket | |
(define (degree->cardinal degree) | |
(case (modulo (inexact->exact (round (* 32 (/ degree 360)))) 32) | |
((0) "N") | |
((1) "NbE") | |
((2) "NNE") | |
((3) "NEbN") | |
((4) "NE") | |
((5) "NEbE") |
This file contains 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
#lang racket | |
(define (helper dir1 dir2 sub) | |
(cond | |
[(= sub 1) dir1] | |
[(= (modulo sub 4) 0) (string-append "b" dir1)] | |
[(= (modulo sub 2) 0) (string-append "b" dir2)] | |
)) | |
(define directions "NESESWNW") |
This file contains 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
#lang racket | |
(define (degree->radian degree) | |
(* (/ (* 2 pi) 360) degree)) | |
(define (radian->degree radian) | |
(* (/ 360 (* pi)) radian)) | |
(define (my-acos alpha) | |
(if (= alpha 0) |
This file contains 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
<?php | |
/** | |
* Is this possible in php5.4 using traits? | |
*/ | |
trait Hashmap { | |
public function set($key, $val) { | |
$this->data[$key] = $val; |