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
interface Fish { int getNumberOfScales(); } | |
interface Piano { int getNumberOfScales(); } | |
class Tuna implements Fish, Piano { | |
// You can tune a piano, but can you tuna fish? | |
int getNumberOfScales() { return 91; } | |
} |
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
object Frangipani { | |
// Add path to native libraries | |
val jarName = getClass.getProtectionDomain.getCodeSource.getLocation.getPath | |
val nativeDir = new File(new File(jarName).getParent, "natives").getPath | |
System.setProperty("org.lwjgl.librarypath", nativeDir) | |
def start() { | |
// Initialize the display | |
try { | |
Display.setDisplayMode(new DisplayMode(800, 600)) |
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
yes_letters = set('yt') | |
no_letters = set('nf') | |
def read_bool(prompt): | |
'''Read a boolean value from standard input.''' | |
answer = None | |
while answer not in yes_letters and answer not in no_letters: | |
answer = raw_input(prompt).strip()[0].lower() | |
return answer in yes_letters |
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
// Duck.java | |
class Duck { | |
public static void quack(Integer num) { | |
System.out.println(num); | |
} | |
} | |
// Main.java | |
class Main { | |
public static void main(String[] args) { |
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 BirdTree where | |
import Control.Monad.Maybe | |
import Control.Monad.State | |
import Data.ByteString.Char8 ( ByteString ) | |
import qualified Data.ByteString.Char8 as B | |
import Data.Char ( isSpace ) | |
import Data.Functor ( (<$>) ) |
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 Data.ByteString.Char8 ( ByteString ) | |
import qualified Data.ByteString.Char8 as B | |
import Data.Char ( isSpace ) | |
import Data.Functor ( (<$>) ) | |
import Data.List ( intercalate, unfoldr ) | |
import Data.Maybe ( fromJust ) | |
import Data.Ratio ( (%) ) | |
{- |
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 Data.ByteString.Char8 ( ByteString ) | |
import qualified Data.ByteString.Char8 as B | |
import Control.Applicative ( (<$>), (<*>) ) | |
import Data.Char ( isSpace ) | |
import Data.List ( intercalate ) | |
import Data.Maybe ( catMaybes ) | |
import Data.Ratio ( (%), numerator, denominator ) | |
{- |
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
-- | FizzBuzz: an example program, similar in purpose to the infamous | |
-- Hello World, that serves to demonstrate the features and syntax of | |
-- the language in which it is written. | |
-- | |
-- The rules of the game are as follows: | |
-- | |
-- 1. If the number is divisible by 3, return \"Fizz\"; | |
-- | |
-- 2. If the number is divisible by 5, return \"Buzz\"; | |
-- |
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 : Saliva.Model.OldExp | |
-- Copyright : GPLv3 | |
-- | |
-- Maintainer : chrisyco@gmail.com | |
-- Portability : portable | |
-- | |
-- The 'Exp' data type, for representing lambda expressions. | |
module Saliva.Model.OldExp |
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
#include <stdlib.h> | |
#include <unistd.h> | |
int main() { | |
size_t sz = sysconf(_SC_PAGESIZE); | |
for (;;) { | |
char *leak = malloc(sz); | |
leak[0] = 'a'; | |
} |
OlderNewer