Skip to content

Instantly share code, notes, and snippets.

View s0ren's full-sized avatar

Søren Magnusson s0ren

  • Technical Education Copenhagen - TEC
  • Stæhr Johansens vej 5, DK-2000 Frderiksberg, Denmark
  • 21:10 (UTC -12:00)
View GitHub Profile
@s0ren
s0ren / sort_hand.js
Created March 29, 2017 13:18
Tips til poker simulation i Beginning Javascript
// kræver at isHeigherThan() og isLowerThan() er defineret og virker.
function sortHand(hand) {
hand.sort(function (a, b) {
if (isHigherThan(a, b))
return 1;
else if (isLowerThan(a, b))
return -1;
else
return 0;
});
@s0ren
s0ren / index.html
Created March 7, 2017 08:04
Peopos js demo
<!DOCTYPE html>
<html>
<head>
<title>Geolocation</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
@s0ren
s0ren / Forms1.cs
Created March 6, 2017 14:53
Morten Billedviser Problem
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
@s0ren
s0ren / practice.js
Created December 15, 2016 12:30
Exercise mapToTags
// Using the `isHTMLElement` and `getTagName` function from one of the previous
// sections, write a function called `mapToTags` that accepts an array of HTML
// elements and returns a new array that consists of only the tags associated with
// those HTML elements. It should throw an error if any of the elements are not
// HTML elements, or if the input is not an array.
//
// mapToTags(["<p>this is a paragraph</p>", "<span>this is a span</span>", "<li>this is a list item</li>"]);
// //=> ["p", "span", "li"]
//
// mapToTags([]);
@s0ren
s0ren / Program.cs
Created October 26, 2016 11:11
Tæl ord og punktummer mv, og beregn LIX tal.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Lix
{
class Program
{
@s0ren
s0ren / Program.cs
Created October 26, 2016 07:55
Brug DateTime til at tælle søndage
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// Se også om DateTime
// https://msdn.microsoft.com/en-us/library/system.datetime(v=vs.110).aspx
// og om formatering
// https://msdn.microsoft.com/en-us/library/8tfzyc64(v=vs.110).aspx
@s0ren
s0ren / Program.cs
Created October 7, 2016 10:10
Opdeling af program med forskellige sprog
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DanskEngelsk
{
class Program
{
@s0ren
s0ren / Program.cs
Created October 7, 2016 09:32
Indlæs tal fra Console.ReadLine(). TryParse med det hele
namespace GamleOle
{
class Program
{
static void Main(string[] args)
{
Console.Write("Indtast din alder: ");
//double alder = Convert.ToDouble(Console.ReadLine());
double alder;
while (!Double.TryParse(Console.ReadLine(), out alder))
@s0ren
s0ren / Search.aspx.cs
Last active May 24, 2016 12:09
Simpelt, men dynamisk sql
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Seach : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
@s0ren
s0ren / RestAfgang.php
Last active December 9, 2015 11:36
Demo af rest api mofd rejseplanen
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Afgange fra Fasanvej</title>
</head>
<body>
<?php
$config["baseUrl"] = "http://xmlopen.rejseplanen.dk/bin/rest.exe";