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
#[derive(Component)] | |
struct ScrollableElement { | |
mask: Entity, | |
content_container: Entity, | |
scroll_bar_element: Entity, | |
scroll_bar_handle: Entity, | |
scroll_value: f32, | |
} | |
impl ScrollableElement { |
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
use std::time::Duration; | |
use bevy::prelude::*; | |
use crate::SimState; | |
#[derive(Resource)] | |
pub struct GameClock { | |
delta: Duration, |
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
type Input = (); | |
type Condtion = fn(Input) -> bool; | |
type Procedure = fn(); | |
#[derive(Clone)] | |
enum AbstractBoolean { | |
And(Box<AbstractBoolean>, Box<AbstractBoolean>), | |
Or(Box<AbstractBoolean>, Box<AbstractBoolean>), | |
Par(Box<AbstractBoolean>), | |
Not(Box<AbstractBoolean>), |
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 qualified Data.Set as S | |
import qualified Data.Map.Strict as M | |
import Data.List.Split (splitOn) | |
import Data.List (stripPrefix) | |
import Data.Maybe (fromJust) | |
newtype Fix f = In { out :: f (Fix f) } | |
type Algebra f a = f a -> a |
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
module Derptastic where | |
someFunction :: IO () | |
someFunction = readFile (".aFile") >>= putStrLn | |
otherFunction :: (Num t, Eq t) => t -> t -> t | |
otherFunction a b | |
| a == 5 = b | |
| otherwise = a |
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
{- | |
steve_clean () { | |
toplost=$(for i in $(ls /fileserver/lost+found/); do echo "$(ls /fileserver/lost+found/$i | wc -l) : ${i}"; done | sort -h -r ) | |
rmain=$(echo -E "$toplost" | wc -l) | |
for i in $(echo -E "$toplost" | cut -d':' -f2 | sed 's/ //'); do | |
echk=$(ls -la $i | wc -l) | |
if [[ $echk == 3 ]] ; then | |
echo "Empty path, removing $i" | |
rm -rf $i; | |
((rmain--)); |
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
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
module Example () where | |
import Control.Monad | |
import Control.Monad.IO.Class | |
import Control.Monad.State.Strict | |
type MyAppState = Int -- Your state implementation here. |
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
fizzBuzzing :: [Int] -> IO () -- Function name and type signature. Says : Take an array of Int and return an IO action of (). () is pronounced 'unit', similar to Java's void. | |
fizzBuzzing a = -- function named fizzBuzzing with argument a is defined as... | |
case a of -- given a value a of | |
[] -> return () -- a blank list, do nothing. 'return' casts the value () as an IO (), which is necessary to type-check. | |
(x:xs) -> do -- for a list of the form x : xs, where x is the first item and xs is the rest of the list 'do..' | |
decide x -- do notation allows us to put multiple statements in a row, where the last one is the final result statement of the function. This requires the return type to implement an instance of the Monad typeclass - a more complicated subject. | |
fizzBuzzing xs -- t |
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
flipT :: (x,y) -> (y,x) | |
flipT (x,y) = (y,x) | |
splitOnes :: (Eq a, Ord a) => [a] -> [([a],[a])] | |
splitOnes xs = map flipT . M.toList . M.fromList . map flipT . map (\n -> partition (==n) xs) $ xs | |
splitTwos :: (Eq a, Ord a) => [a] -> [([a],[a])] | |
splitTwos xs = map flipT . M.toList . M.fromList . concatMap splitAgain . splitOnes $ xs | |
where | |
splitAgain (n,xs) = |
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
passesPredicate :: (POExpinDoc -> Bool) -> (Either ParseError POExpinDoc -> Bool) | |
passesPredicate p = either (\_ -> True) (p) | |
both :: (a->c) -> (b->c) -> Either a b -> Either c c | |
both fl fr inp = | |
case inp of | |
Left l -> Left (fl $! l) | |
Right r -> Right (fr $! r) | |
NewerOlder