Skip to content

Instantly share code, notes, and snippets.

Avatar
🦄
Jumping over Rainbows...

Theofanis Despoudis theodesp

🦄
Jumping over Rainbows...
View GitHub Profile
@theodesp
theodesp / animate.ts
Created May 15, 2020
Animate Element
View animate.ts
const easeInOutSin = (time: number): number => {
return (1 + Math.sin(Math.PI * time - Math.PI / 2)) / 2;
};
interface AnimateElementByPropArgs {
propToAnimate: string;
element: Element;
moveTo: number;
duration?: number;
}
@theodesp
theodesp / gist:8e6972aa0714522f843a98219bf52e3a
Last active Apr 28, 2020
Graphics Programming Resources
View gist:8e6972aa0714522f843a98219bf52e3a
## Beginner
### Ray Casting
* https://en.wikipedia.org/wiki/Ray_casting
* https://lodev.org/cgtutor/raycasting.html
* https://github.com/permadi-com/ray-cast
* https://rosettacode.org/wiki/Ray-casting_algorithm
* https://permadi.com/1996/05/ray-casting-tutorial-table-of-contents/
* https://courses.pikuma.com/courses/raycasting
* https://people.cs.clemson.edu/~dhouse/courses/405/notes/raycast.pdf
View package.json
"dependencies": {
"gatsby": "^2.20.12",
"gatsby-plugin-manifest": "^2.1.1",
"gatsby-plugin-offline": "^2.1.1",
"gatsby-plugin-react-helmet": "^3.0.12",
"gatsby-source-filesystem": "^2.0.38",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-helmet": "^5.2.1",
},
View FetchedDogPictures.re
// This is a proper alternative to
// https://github.com/BuckleScript/bucklescript/blob/b9508105b1a35537bdea9a1fabd10f6c65f776b4/jscomp/bsb/templates/react-hooks/src/FetchedDogPictures/FetchedDogPictures.re#L14
// The one in that file uses Promise, but that's *wrong*.
// We only used promise as a demo of its API. We'll remove it soon.
// As you can see below, the pure XMLHttpRequest code is just as clean,
// less mysterious for all, more performant, extensible, and actually correct.
// Ignore these externals for now. They're just for illustration
// purposes. I just copy pasted the Js code from
@theodesp
theodesp / main.java
Created Mar 12, 2020
Get Current Locale
View main.java
package com.thdespou;
import java.util.Locale;
public class Main {
public static void main(String[] args) {
System.out.println(Locale.getDefault());
}
}
@theodesp
theodesp / main.java
Created Mar 11, 2020
ZonedDateTime example
View main.java
package com.thdespou;
import java.time.*;
public class Main {
public static void main(String[] args) {
Instant now = Instant.now();
ZonedDateTime zdt = ZonedDateTime.ofInstant(now,
ZoneId.systemDefault());
View main.java
package com.thdespou;
import java.time.Instant;
public class Main {
public static void main(String[] args) {
Instant now = Instant.now();
System.out.println("Date is " + now);
}
@theodesp
theodesp / main.java
Last active Mar 11, 2020
Date with Timezone
View main.java
package com.thdespou;
import java.util.Date;
import java.util.TimeZone;
public class Main {
public static void main(String[] args) {
// Date
Date now = new Date();
@theodesp
theodesp / main.java
Created Mar 11, 2020
Get current time
View main.java
package com.thdespou;
import java.util.Date;
public class Main {
public static void main(String[] args) {
// Date
Date now = new Date();
System.out.println("Current Date in milliseconds is :" + now.getTime());
You can’t perform that action at this time.