Skip to content

Instantly share code, notes, and snippets.

/* This code was written by Sergejs Kovrovs and has been placed in the public domain. */
import QtQuick 2.0
MouseArea {
property point origin
property bool ready: false
signal move(int x, int y)
signal swipe(string direction)
@missdeer
missdeer / gist:54570737b21a11e124c6
Created September 1, 2014 03:53
unmarshal non-utf8 xml
import "code.google.com/p/go.net/html/charset"
ad := &models.ArticleDocument{}
d := xml.NewDecoder(bytes.NewReader([]byte(xmldoc)))
d.CharsetReader = func(s string, r io.Reader) (io.Reader, error) {
return charset.NewReader(r, s)
}
d.Decode(ad)
package main
import (
"fmt"
"log"
"net"
"net/mail"
"net/smtp"
"crypto/tls"
)
@missdeer
missdeer / isPrime.js
Created November 11, 2013 02:39
isPrime.js, regexp magic
function isPrime(i) {
var ones = "";
while(--i >= 0) ones += "1";
return !/^1?$|^(11+?)\1+$/.test(ones);
}