Skip to content

Instantly share code, notes, and snippets.

--Create functions to do the following:
{- Solutions to the questions I gave last week.
Note: This is the way I would answer these questions. In Haskell, there
are usually many ways to get the same solution, so dont worry if
any of your answers are different. If you have a solution that is
different, please lete me know.
If you have any questions, please ask me. Use the Moodle Forum, the
facebook group or the email address I posted on the Facebook page. I am
@Jiggins
Jiggins / Temp.java
Last active August 29, 2015 14:07
Output of a valiant effort
import java.util.Scanner;
public class Temp{
public static void main (String [] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
if (n == 1) {System.out.println("2");}
if (n == 2) {System.out.println("4");}
if (n == 3) {System.out.println("8");}
module SAP where
import Data.Function
import Data.List
import Data.List.Split
import System.IO
data Token = Token {colour :: Colour, value :: Int}
deriving (Eq)
@Jiggins
Jiggins / Shootout.md
Last active August 29, 2015 14:17
Minds Language Shootout Results

Shootout results

Name Language
Alex Mitchell Clojure
Anne McLoughlin Julia
Cathal McGovern Oz
Conor Fitz FORTRAN
Conor Loney Forth
Darren Coyle Elixir
Fionn Collander BASIC

Minds AGM 30-05-2015

Minutes

Minds and Computer Science Department party

  • Thursday 7th May
  • Time: 7pm
  • Location: Th Loft in McMahon's

Review of Minds in 2014-2015

Clock Cycles

The following code takes 6 seconds to run on a DOS box emulator. Calculate the number of clock cycles required for the highlighted code (A) to run?

Ok so for this part you need to count the number of cycles this program will execute. Each comment will tell you how many cycles each instruction takes. E.g. It takes 4 clock cycles to run mov bx, 100. On the jump instructions, you will see something like '16 backward 4 forward', this means if the jump instruction jumps back, it will yake 16 cycles, if it doesn't jump, it will take 4.

In this example, when cx > 0, jnz back1 will take 16 cycles. But when cx == 0, it will take 4 cycles.

@Jiggins
Jiggins / compare_dirs.rb
Last active August 29, 2015 14:27
ruby compare_dirs.rb /path/to/dir1 /path/to/dir2
require 'pp'
# https://gist.github.com/awesome/3842062
def dirHash(path)
Dir["#{path}/**/*"].inject({}) {|h,i| t = h; i.split("/").each {|n| t[n] ||= {}; t = t[n]}; h}
end
# https://gist.github.com/henrik/146844
def deep_diff(a,b)
(a.keys | b.keys).inject({}) do |diff, k|
#! /bin/bash
# For one line installation, use the command in the comment on the next line
# bash <(curl https://gist.githubusercontent.com/Jiggins/081007c09d96afbc12bf/raw/9a6132f4c5459e332bf53fc897d76163e5585d75/git-setup.sh)
echo -n "Enter your name: "
read -e NAME
echo -n "Enter your Student Number: "
read -e STUDENT_NUMBER
module Maybe where
import Prelude hiding (Maybe (..))
-- Take a look at Hackage: Data.Maybe
-- https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-Maybe.html
data Maybe a = Nothing
| Just a

Rails

Getting Started

rails new Dema
bundle install

rails server