This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule YourApp.Validators.Email do | |
use Ecto.Changeset | |
@mail_regex ~r/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/ | |
# ensure that the email looks valid | |
def validate_email(changeset, field) do | |
changeset | |
|> validate_format(field, @mail_regex) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE CONSTRAINT ON (l:Location) ASSERT l.locationid IS UNIQUE; | |
CREATE INDEX ON :Location(locationid); | |
USING PERIODIC COMMIT 5000 | |
LOAD CSV WITH HEADERS FROM 'file:///wln_label-type.txt.csv' AS line WITH line | |
MERGE (location:Location {locationid: toInt(line.locationid)} ) | |
RETURN COUNT(location); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Created on Wed May 25 11:26:57 2016 | |
@author: julius | |
""" | |
import getopt, sys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule ListAndRecursion do | |
def all?([head | tail], filter) do | |
if filter.(head) == true do | |
pall?(tail, filter, true) | |
else | |
false | |
end | |
end | |
defp pall?([head | tail], filter, _previous) do | |
if filter.(head) == true do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://digitalezeitung.morgenweb.de/ePaper/app/index.html | |
ConfigOptions.hasUserSubscriptions = true; | |
ConfigOptions.appMode = "full"; | |
ConfigOptions.loggedByIp = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func writeProtoTextResponse(w http.ResponseWriter, pb proto.Message) { | |
data, err := proto.Marshal(pb) | |
//w.Header().Set("Content-Length", strconv.Itoa(len(data))) | |
fmt.Println(err) | |
fmt.Println(data) | |
fmt.Fprint(w, data) | |
} | |
func TestGetProduct(t *testing.T) { | |
client := &http.Client{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @id ClickerMonkeys | |
// @name Clicker Monkeys | |
// @namespace . | |
// @version 1.4.2801 | |
// @authors Zininzinin, unv_annihilator | |
// @description Trying to automate ALL THE THINGS with clicker heroes | |
// @include http://www.clickerheroes.com/ | |
// @grant none | |
// @require http://code.jquery.com/jquery-2.1.1.min.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Cell | |
{ | |
Cell( PVector ul, PVector ur, PVector lr, PVector ll, | |
float vul, float vur, float vlr, float vll, | |
PVector v2Dvul, PVector v2Dvur, PVector v2Dvlr, PVector v2Dvll) | |
{ | |
upperLeft = ul; | |
upperRight = ur; | |
lowerRight = lr; | |
lowerLeft = ll; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def mean(C): | |
m = np.array([0,0]) | |
for c in C: | |
m += c | |
m = m * (1/len(C)) | |
return m | |
def recalc(C, F, k, centroids): | |
sqe = 0 | |
# assign features to clusters based on distance to centroids |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyTagsHandler(xml.sax.handler.ContentHandler): | |
def __init__(self): | |
xml.sax.handler.ContentHandler.__init__(self) | |
self.tags = dict() | |
self.edges = dict() | |
self.k = 0 | |
def assemble_tag_list(self, s): | |
s = s.replace("<", "") | |
s = s.replace(">", " ") | |
s = s.strip() |
NewerOlder