Skip to content

Instantly share code, notes, and snippets.

View Shamrock-Frost's full-sized avatar
🐻

Brendan Seamas Murphy Shamrock-Frost

🐻
View GitHub Profile
++++++++[>++++++++++<-]++++++++++[>>++++++++++<<-]>>+<<++++++++++[>>>+++++++++++<<<-]++++++++++[>>>>++++++++++<<<<-]>>>>+++++<<<<++++++++++[>>>>>+++++++++++<<<<<-]>>>>>+++++<<<<[.[-]>]
@FunctionalInterface
interface Test {
public abstract void doThing();
}
//Place where code would be run
List<Test> tests = new ArrayList();
tests.add(() -> System.out.println("1"));
tests.add(() -> System.out.println("2"));
tests.add(() -> System.out.println("3"));
@Shamrock-Frost
Shamrock-Frost / March14.hs
Last active March 14, 2016 18:52
Creates a 730x730 image representing π in base 2. Each 1 is a white 5x5 square, each 0 is a black 5x5 square.
--Made for Pi day 2016
module PiDay(main) where
import Graphics.Gloss
import Data.Fixed
type Rectangle = [Float]
rSize :: Float
@Shamrock-Frost
Shamrock-Frost / gist:4fc68da8771314a5ed46cb3db57361ae
Created May 7, 2016 20:46 — forked from dodyg/gist:5823184
Kotlin Programming Language Cheat Sheet Part 1

#Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.

package sample;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.io.IOException;
public class Main extends Application {
package sample;
public class Controller {
}
<?import javafx.geometry.Insets?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<GridPane fx:controller="sample.Controller"
xmlns:fx="http://javafx.com/fxml" alignment="center" hgap="10" vgap="10">
</GridPane>
@Shamrock-Frost
Shamrock-Frost / Biology.hs
Last active May 31, 2016 00:54
Biology extra credit
module Main (main) where
import Data.Char (toLower)
import Prelude hiding (Either)
import Phyla
data Key a = Answer a | Either Question (Key a) (Key a)
instance (Show a) => Show (Key a) where show (Answer x) = show x
type Question = String
@Shamrock-Frost
Shamrock-Frost / HyperOperations.hs
Created June 24, 2016 07:19
Halle told me about an interview question at Microsoft, and I joked I'd solve it monoidally. I wasn't joking, Halle.
import Data.Monoid hiding (Sum)
class Monoid a => IntWrapper a where toInt :: a -> Int
newtype Sum = Sum Int deriving (Show, Eq)
instance IntWrapper Sum where toInt (Sum n) = n
instance Monoid Sum where
mempty = Sum 0
mappend (Sum a) (Sum b) = Sum (a + b)
@Shamrock-Frost
Shamrock-Frost / EvilCode.hs
Last active August 21, 2016 04:49
Turn back all ye who enter here, for the black magic of {-# LANGUAGE RebindableSyntax #-} is afoot. This is the worst code I've ever written. The f# code is probably more idiomatic?
{-# LANGUAGE RebindableSyntax #-}
import Prelude hiding ((>>=), return)
main = mapM_ (putStrLn . fizzbuzz) [1..100]
fizzbuzz n = do
fizz <- (3, "Fizz")
buzz <- (5, "Buzz")
return $ fizz ++ buzz