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 / 0_reuse_code.js
Created February 10, 2014 13:18
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@follesoe
follesoe / karma.config.js
Last active August 29, 2015 13:56
Aktørportalen karma
// Karma configuration
// Generated on Fri Feb 07 2014 14:46:59 GMT+0100 (Romansk (normaltid))
module.exports = function(config) {
config.set({
// base path, that will be used to resolve files and exclude
basePath: '',
@follesoe
follesoe / module.cs
Created December 19, 2013 12:48
Test
public class DummyAuthModule : IHttpModule
{
public void Init(HttpApplication context)
{
context.AuthenticateRequest += ContextOnAuthenticateRequest;
}
private void ContextOnAuthenticateRequest(object sender, EventArgs eventArgs)
{
var identity = new GenericIdentity("test user");
@follesoe
follesoe / questions.js
Created September 9, 2013 09:42
Oppdaterte spørsmål
var questions = {
'Introduksjon-1':
{
id: 'Introduksjon-1',
question: 'Er du mann eller kvinne?',
instructions: '',
questionType: 'Alternativknapper',
datatype: 'Int',
alternatives: ["Mann", "Kvinne"],
nextQuestions: ["Introduksjon-2", "Introduksjon-2"],
@follesoe
follesoe / anagram.rb
Last active December 22, 2015 00:18
Find variable length anagrams based on dictionary
words = Hash.new([])
File.open("words.txt", "r") do |file|
while line = file.gets
word = line.chomp.downcase
words[word.split('').sort!.join('')] += [word]
end
end
File.open("names.txt", "r") do |file|
@follesoe
follesoe / RegObs.fsx
Created March 20, 2013 09:39
Consuming RegObs OData Feed from F#
#r "FSharp.Data.TypeProviders"
#r "System.Data.Services.Client"
open System
open Microsoft.FSharp.Linq
open Microsoft.FSharp.Data.TypeProviders
type RegObs = ODataService<"http://api.nve.no/hydrology/regobs/v0.8.7/Odata.svc">
let data = RegObs.GetDataContext()
@follesoe
follesoe / LoopVid.rb
Created March 15, 2013 10:02
Droplet to loop videos dropped on the application
on open of target_files
set theMovie to target_files
tell application "QuickTime Player"
activate
open theMovie
set the looping of document 1 to true
play document 1
end tell
end open
@follesoe
follesoe / webserver.cs
Created March 5, 2013 12:20
Simple webserver in .NET
class WebServer
{
public void Start()
{
var listener = new System.Net.HttpListener();
listener.Prefixes.Add(BaseUrl);
listener.Start();
new Thread(HttpThread).Start(listener);
}
@follesoe
follesoe / extreme_startup.fs
Created February 28, 2013 20:08
Extreme Startup Answers in F#
module Answers
open System
open System.Text
let (|Regex|_|) regex str =
let m = RegularExpressions.Regex(regex).Match(str)
if m.Success
then Some (List.tail [ for x in m.Groups -> x.Value ])
else None
alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split("")
base = alphabet.length
exports.encode = (i) ->
return alphabet[0] if i is 0
s = ""
while i > 0
s += alphabet[i % base]
i = parseInt(i / base, 10)