Skip to content

Instantly share code, notes, and snippets.

View follesoe's full-sized avatar
📱
Working on Skredvarsel app

Jonas Follesø follesoe

📱
Working on Skredvarsel app
View GitHub Profile
@follesoe
follesoe / birthday.md
Created September 4, 2012 16:08
Puzzles solved in Prolog

Five sisters

Five sisters all have their birthday in a different month and each on a different day of the week. Using the clues below, determine the month and day of the week each sister's birthday falls.

  1. Paula was born in March but not on Saturday. Abigail's birthday was not on Friday or Wednesday.
  2. The girl whose birthday is on Monday was born earlier in the year than Brenda and Mary.
  3. Tara wasn't born in February and her birthday was on the weekend.
  4. Mary was not born in December nor was her birthday on a weekday. The girl whose birthday was in June was born on Sunday.
  5. Tara was born before Brenda, whose birthday wasn't on Friday. Mary wasn't born in July.

Puzzle taken from puzzelersparadise.com.

@follesoe
follesoe / streaming.html
Created March 18, 2020 08:51
Blueye player HTML
<script type="text/javascript" src="//player.wowza.com/player/latest/wowzaplayer.min.js"></script>
<div id="playerElement"style="padding:0 0 56.25% 0"></div>
<script type="text/javascript">
var streamConfig = {
"license":"PLAY2-6VKVk-ZmzTk-UD7YP-BmNjc-4E3XN",
"sources":[
{
"sourceURL":"wss://edge.cdn.wowza.com/live/_definst_/0P0p2dVQ4K0JucG9zUjZTaUVSdFp5833/stream.ws"
},
{
public override void Show(MvxViewModelRequest request)
{
if (request.ViewModelType == typeof(SettingsViewModel))
{
var page = CreatePage(request);
var viewModel = LoadViewModel(request);
page.DataContext = viewModel;
var vc = page.CreateViewController();
var attr = new MvxTabPresentationAttribute
c:\FTS\Apps\blueye\Resources\P2-functional-tests>python test.py test_upload_swupdate
INFO test_upload_swupdate: starting
Traceback (most recent call last):
File "test.py", line 7, in <module>
exit(testcases.tests())
File "C:\Users\tczkkepa\AppData\Local\Programs\Python\Python36\lib\site-packages\click\core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "C:\Users\tczkkepa\AppData\Local\Programs\Python\Python36\lib\site-packages\click\core.py", line 697, in main
rv = self.invoke(ctx)
File "C:\Users\tczkkepa\AppData\Local\Programs\Python\Python36\lib\site-packages\click\core.py", line 1066, in invoke
@follesoe
follesoe / ObservableZeroconf.cs
Created June 27, 2018 20:13
System.Reactive based Bonjour Browser
public class ObservableZeroconf : IObservableZeroconf
{
public ObservableZeroconf()
{
}
public IObservable<Service> Search(string serviceType)
{
var browser = new NSNetServiceBrowser();
browser.Schedule(NSRunLoop.Current, NSRunLoopMode.Default.ToString());
@follesoe
follesoe / Program.cs
Created June 25, 2018 18:30
Attempt at extending example further
static void Main(string[] args)
{
var browser = new ServiceBrowser();
var observableFound =
Observable.FromEventPattern<ServiceFoundEventArgs>(
h => browser.ServiceFound += h,
h => browser.ServiceFound -= h)
.Select(e => e.EventArgs.Service);
@follesoe
follesoe / Program.cs
Created June 23, 2018 13:44
Event Based API example - how to turn this into System.Reactive Observable<Service>?
using System;
using System.Reactive;
using System.Reactive.Linq;
using System.Threading.Tasks;
namespace ReactiveLearning
{
class Program
{
static void Main(string[] args)
@follesoe
follesoe / RubyXmlDslExercise.md
Created May 22, 2012 16:57
Simple Ruby XML DSL exercise implemented by Torgeir and Jonas

Simple Ruby DSL to generate XML

Implemented as an exercise to learn about metaprogramming in Ruby. The DSL is implemented using instance_eval and method_missing.

Usage

require 'xmldsl'

Twitter = Struct.new :name, :avatar, :text
twitters = []
5.times { twitters << Twitter.new("Jonas", "/profile.png", "Hello World!") }
@follesoe
follesoe / Cropping an image.cs
Created March 22, 2011 22:29
MonoTouch example of cropping an image.
public UIImage Crop(UIImage image, RectangleF section)
{
// Start context.
UIGraphics.BeginImageContext(section.Size);
var ctx = UIGraphics.GetCurrentContext();
// Clear the image with red.
ctx.SetRGBFillColor(255, 255, 255, 255);
ctx.FillRect(new RectangleF(new PointF(0, 0), section.Size));
@follesoe
follesoe / compass.js
Last active October 13, 2016 19:07
Silly implementation of compass UI in console to understand how to implement it.
function difference(a, b) {
var diff = b - a;
var absDiff = Math.abs(diff);
if (absDiff <= 180)
{
return absDiff == 180 ? absDiff : diff;
}
else if (b > a)
{
return absDiff - 360;