Skip to content

Instantly share code, notes, and snippets.

View jonaslu's full-sized avatar
💩

Jonas Lundberg jonaslu

💩
View GitHub Profile
@jonaslu
jonaslu / diff_js_object.js
Last active February 7, 2017 12:56
Deep diffing a js-object ignoring arrays
const test1 = {
k0: 1,
k1: 1,
k3: 3,
k4: {
c: 4
},
k5: {
c: 2
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html b:version='2' class='v2' expr:dir='data:blog.languageDirection' xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'>
<head>
&lt;!-- /*<b:skin><![CDATA[*/]]></b:skin>
</head>
<body>
<h1>TEEEST</h1>
<b:section class='main' id='main' name='Main' showaddelement='no'/>
@jonaslu
jonaslu / pike_and_kerningham_regex_engine.py
Last active July 9, 2016 19:31
Python version of the regex-engine in Pike and Kerningham: Practice of programming.
def match(text, regex):
if not regex:
return True
if regex[0] == '^':
return matchFirst(text, regex[1:])
else:
return matchInString(text, regex)
def matchInString(text, regex):
if not regex:
@jonaslu
jonaslu / spikeTodo.elm
Last active May 29, 2016 10:41
First try of a todo-app in elm. It works but it ain't pretty. Created with my parter in crime @popstr
import Html exposing (..)
import Html.App exposing (beginnerProgram)
import Html.Events exposing (..)
import Html.Attributes exposing (..)
import List exposing (..)
import String
main =
beginnerProgram { model = model, view = view, update = update }