Skip to content

Instantly share code, notes, and snippets.

View snorremd's full-sized avatar

Snorre Magnus Davøen snorremd

View GitHub Profile
fizzbuzz(100):-
write_ln('Buzz').
fizzbuzz(N):-
(0 is N mod 3,
0 is N mod 5,
write_ln('FizzBuzz');
0 is N mod 3,
write_ln('Fizz');
0 is N mod 5,
@snorremd
snorremd / biblatexstuff.tex
Created March 1, 2013 10:29
Latex with BibLatex stuff
%!TEX encoding = UTF-8 Unicode
% Define document class, font size and paper format
\documentclass[a4paper,12pt]{article}
% Set languages and encoding
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[american, norsk]{babel}
\usepackage[babel]{csquotes}
@snorremd
snorremd / gist:5308578
Created April 4, 2013 07:44
Authors: Lisa, Snorre A quick and simple solution for converting from decimal numbers to roman numerals. It is based on a table (double array) lookup-algorithm using a digit's position in a number as well as its value to find the correct roman numeral to add to the roman numeral string/array.
class NumeralRomanConverter
def initialize
@romanTable = [ ["I","IV","V","IX"],
["X","XL","L","LC"],
["C","LC","D","CM"],
["M"]]
end
def numeralToRoman(numeralValue)
numberAsString = numeralValue.to_s
@snorremd
snorremd / Gruntfile.js
Last active December 25, 2015 12:59
My attempt at a lazy-loading coffee task
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.JSON'),
watch: {
files: ['src/**/*.coffee', 'test/**/*.coffee', "app.coffee"],
task: ['coffeelint']
},
coffeelint: {
class Animal
constructor: (@name) ->
@mouth = new Mouth()
@mouth.on("woof", @woof)
this
woof: () ->
@mouth.woof()
class Mouth
\begin{thenomenclature}
\nomgroup{A}
\item [{\makefirstuc {CTC}}]\begingroup Compact Trie Clustering\nomeqref {5.0} \nompageref{57} \item [{\makefirstuc {GA}}]\begingroup Genetic Algorithm\nomeqref {4.0} \nompageref{32}
\end{thenomenclature}
#!/bin/bash
###########################################
# I heart Ubuntu 64 bits
#
# Installs various useful software:
# Please copy to your home folder, right click
# and check "executable" under permissions tab
# and run by typing:
# sudo ~/ubuntusoftwareinstaller.sh
@snorremd
snorremd / docker-compose.yml
Created September 12, 2015 12:53
Ghost docker-compose.yml file to start a Ghost container.
ghost:
image: ghost:latest
ports:
- "2368"
environment:
- "NODE_ENV=production"
- "VIRTUAL_HOST=yourhostname.example"
volumes:
- /srv/ghost:/var/lib/ghost
@snorremd
snorremd / docker-compose.yml
Created September 12, 2015 13:01
nginx and dockergen containers for automatic proxying
nginx:
image: nginx:latest
volumes:
- /tmp/nginx:/etc/nginx/conf.d
- /srv/nginx/certs:/etc/nginx/certs
ports:
- "80:80"
#- "443:443" Only add if you want ssl
dockergen:
var webdriverio = require('webdriverio'),
moment = require('moment');
var options = {
desiredCapabilities: {
browserName: 'firefox'
}
};
var password = process.env.FACEBOOK_PASSWORD,
email = process.env.FACEBOOK_EMAIL,