Skip to content

Instantly share code, notes, and snippets.

View skuro's full-sized avatar

Carlo Sciolla skuro

View GitHub Profile
@skuro
skuro / fossa_parser.clj
Last active June 11, 2018 19:27
Fugly but works
(ns fossa-parser.core
(:require [clojure.java.io :as io]
[clojure.string :as string]))
(defn maybe-license
"If a license header is found, returns the license"
[[pre lic post]]
(let [thick-line #"^=+$"]
(when (and (re-matches thick-line pre)
(re-matches thick-line post))
@skuro
skuro / README.md
Created May 16, 2018 19:31
Dutch Clojure Meetup #102

Submissions for the clojure dojo

@skuro
skuro / website.cljs
Created November 5, 2017 15:38
Sample code from the Clojurebridge session #2
(ns nightcoders.removeme
(:require [reagent.core :as r]
[quil.core :as q]))
(enable-console-print!)
(def image-url
"https://i.pinimg.com/originals/96/cc/3a/96cc3aafba195cecfc2662acc405c699.gif")
(def clojurebridge-url
@skuro
skuro / property.py
Last active October 25, 2017 13:18
Using a property object
class Book:
def __init__(self, title, author):
self.title = title
self.author = author
def getShortDescription(self):
"""The getter for the shortDescription property"""
return self.title + ' was written by ' + self.author
@skuro
skuro / trapped_water.clj
Last active September 11, 2017 09:37
Clojure version of the water trapped between towers problem
(defn trapped-water [towers]
(let [maxes #(reductions max %) ; the seq of increasing max values found in the input seq
maxl (maxes towers) ; the seq of max heights to the left of each tower
maxr (reverse (maxes (reverse towers))) ; the seq of max heights to the right of each tower
mins (map min maxl maxr)] ; minimum highest surrounding tower per position
(reduce + (map - mins towers)))) ; sum up the trapped water per position
;; in the following, # is a tower block and ~ is trapped water:
;;
;; 10|
@skuro
skuro / tree.py
Created August 30, 2017 09:41
comments
class TreeNode:
def __init__(self, key, val, left=None, right=None, parent=None):
# key e' inutile
self.key = key
self.payload = val
self.leftChild = left
self.rightChild = right
self.parent = parent
def hasLeftChild(self):
class Node:
def __init__(self, cargo, next=None):
self.cargo = cargo
self.next = next
def __str__(self):
return str(self.cargo)
def search(self, needle):
@skuro
skuro / post-commit-jira.sh
Created February 18, 2013 22:44
A post-commit svn hook to expose links to Trac commits in Jira
#!/bin/sh
# SVN post-commit hook to link revisions to JIRA tickets
#
# Author: Carlo Sciolla <carlo@backbase.com>
# Revision: 0.1
# fill in your Jira credentials and URL:
USER=foo
PASS=test123
>>> import datetime
>>> "oggi e' %s" % datetime.date.today()
"oggi e' 2017-05-04"
>>> "oggi e' %r" % datetime.date.today()
"oggi e' datetime.date(2017, 5, 4)"
@skuro
skuro / README.md
Last active March 8, 2017 20:09 — forked from Gonzih/README.md
markov-chain-meetup-dojo