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
| class Dog { | |
| constructor(name) { | |
| this.name = name; | |
| } | |
| bark() { | |
| return `${this.name} goes bark!`; | |
| } | |
| } |
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
| channels = ["#test", "#world"] | |
| main = do | |
| conn <- connectTo (server bot) $ PortNumber $ fromIntegral $ 6667 | |
| hSetBuffering conn NoBuffering | |
| write conn "USER" $ nick bot ++ " 8 * :" ++ nick bot | |
| write conn "NICK" "haskelbottt" | |
| write conn "JOIN" "#botwars" -- instead I want to loop through channels and pass it AND conn to `write` | |
| listen conn |
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
| List<String> channels = new ArrayList<String>(); | |
| channels.add("#hello"); | |
| channels.add("#world"); | |
| for (String channel : channels) { | |
| System.out.println(channel); | |
| } |
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
| listen :: Handle -> IO () | |
| listen h = forever $ do | |
| s <- hGetLine h | |
| putStrLn s | |
| where | |
| forever a = do a; forever a |
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
| h <- connectTo server (PortNumber (fromIntegral port)) | |
| h <- connectTo server $ PortNumber $ show $ port |
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
| data Person = Person {Name :: String, Age :: Int} | |
| anthony = Person "Anthony" 17 | |
| -- How do I get the value of Name from anthony |
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 ircscalabot | |
| import javax.script.ScriptException | |
| import java.io.{PrintWriter, ByteArrayOutputStream, PrintStream} | |
| import org.json4s._ | |
| import org.json4s.native.JsonMethods._ | |
| import org.json4s.native.Serialization.write | |
| import scala.collection.JavaConverters._ |
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
| import java.io.*; | |
| import java.net.Socket; | |
| /** | |
| * Created by Anthony on 12/21/2015. | |
| */ | |
| public class Bot { | |
| public static void main(String[] args) throws Exception { | |
| Socket socket = new Socket("irc.freenode.net", 6667); |
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 ircscalabot; | |
| import java.io.*; | |
| import java.net.Socket; | |
| /** | |
| * Created by Anthony on 12/19/2015. | |
| */ |
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 ircscalabot | |
| import javax.script.ScriptException | |
| import java.io.{PrintWriter, ByteArrayOutputStream, PrintStream} | |
| import org.json4s._ | |
| import org.json4s.native.JsonMethods._ | |
| import org.json4s.native.Serialization.write | |
| import scala.tools.nsc.Settings |