This file contains hidden or 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
| tool | |
| extends Spatial | |
| var radius = 0.5 # Using 2 for now, since that's the default size of the PlaneMesh object. | |
| # Resolution is the number of squares which our faces have - i.e. r=64 -> 64x64 faces. | |
| export(int) var resolution = 3 | |
| # What data do we need to track? | |
| var meshInst | |
| var triangleIndices = [] # [Vector3] - each element represents the 3 indices which make up a face triangle | |
| var vertices = [] # [Vector3] - each element represents the spatial point that is a vertex |
This file contains hidden or 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
| package main | |
| import ( | |
| "context" | |
| "flag" | |
| "fmt" | |
| "io" | |
| "net" | |
| "net/http" | |
| "os" |
This file contains hidden or 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
| module FindWeekday where | |
| -- The ordering of this has to be weird | |
| -- due to the result of modding the number of days | |
| -- the date has. | |
| -- This is because if we mod a number of days that is | |
| -- evenly divisble by 7 we get 0 which would not be the | |
| -- correct index of the day, so just shift the list of | |
| -- days to fit with this skewing as seen below. | |
| daysOfWeek :: [String] |
This file contains hidden or 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
| /* find the sum of all the even fibonacci numbers less that 4 million */ | |
| #include <iostream> | |
| // We need to first calculate the fibonacci numbers up to some bound | |
| // This is going to be hard to do as elegantly or as efficiently as in Haskell | |
| // Let's first define a funciton to quickly calculate the nth fib num | |
| int nth_fib_r (int prev, int val, int n) { | |
This file contains hidden or 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
| -- This is some pretty cool math trickery | |
| -- I cannot take credit for coming up with it. | |
| -- Thanks random stack overflow user <3 | |
| rev_int :: Int -> Int | |
| rev_int 0 = 0 | |
| rev_int n = mod n 10 * 10^place + rev_int(div n 10) | |
| where | |
| n' = fromIntegral n | |
| place = (floor . logBase 10) n' |
This file contains hidden or 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
| ;; Author sible777 | |
| ;; Why? I dunno I was bored and in the process | |
| ;; of learning clojure... | |
| (ns coolstuff) | |
| ;; Detect if a string is a palindrome. | |
| ;; True if it is false otherwise. | |
| (defn palindrome [string] | |
| (if (= (seq string) (into '() (seq string))) |