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 DateTimeSplittable | |
extend ActiveSupport::Concern | |
included do | |
def self.split_date_time(*attributes) | |
attributes.each do |attribute| | |
if self.type_for_attribute(attribute).type != :datetime | |
raise ArgumentError.new("#{attribute} is not of type datetime") | |
end |
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
.callout { | |
padding: 1.25rem; | |
margin-top: 1.25rem; | |
margin-bottom: 1.25rem; | |
border: $card-border-width solid $card-border-color; | |
border-left-width: .25rem; | |
@include border-radius($card-border-radius); | |
h2,h3,h4,h5 { | |
margin-top: 0; |
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
# frozen_string_literal: true | |
# adapted from Gutentag's install migrations | |
# https://github.com/pat/gutentag | |
superclass = ActiveRecord::VERSION::MAJOR < 5 ? | |
ActiveRecord::Migration : ActiveRecord::Migration[4.2] | |
class ConvertToGutentag < superclass | |
def up | |
## taggings |
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 <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#define APPEND 1 | |
#define DELETE 2 | |
#define PRINT 3 | |
#define UNDO 4 | |
#define MAX_INPUT 1000000 |
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 Main (main) where | |
import Control.Monad | |
import Control.Applicative | |
isOpener :: Char -> Bool | |
isOpener '(' = True | |
isOpener '[' = True | |
isOpener '{' = True | |
isOpener _ = False |
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::io; | |
use std::collections::HashMap; | |
use std::borrow::ToOwned; | |
fn get_number() -> u32 { | |
let mut number = String::new(); | |
io::stdin().read_line(&mut number).expect("expected number"); | |
return number.trim().parse::<u32>().ok().expect("expected number"); | |
} |
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
require "curses" | |
include Curses | |
SNAKE = "\u2588\u2588" | |
init_screen | |
begin | |
crmode | |
curs_set 0 |
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
myLastButOne :: [a] -> a | |
myLastButOne [] = error "Not enough elements!" | |
myLastButOne [x] = error "Not enough elements!" | |
myLastButOne [x,y] = x | |
myLastButOne (_:xs) = myLastButOne 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
noRem :: Int -> Int -> Bool | |
noRem x y = (rem x y) == 0 | |
fizzbuzz :: Int -> String | |
fizzbuzz x | |
| noRem x 15 = "fizzbuzz" | |
| noRem x 3 = "fizz" | |
| noRem x 5 = "buzz" | |
| otherwise = show x | |
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
/* | |
* COM1001 Crossover Assignment 1 | |
* Team 10 | |
*/ | |
import sheffield.*; | |
public class CodeTeam10 { | |
private static Student[] students; | |
private static Lecturer[] lecturers; |
NewerOlder