Skip to content

Instantly share code, notes, and snippets.

View arouel's full-sized avatar

André Rouél arouel

View GitHub Profile
@aslakknutsen
aslakknutsen / blog.md
Created April 19, 2012 16:25
Import your project's history in Sonar

When you do your first Sonar run on your project, you get a lot of new quality numbers to play with, but no trends. You only have one data set for comparison, the now picture.

Wouldn't it be nice if you could see the current trend of the project without waiting a couple of month for the 'daily/weekly' Sonar runs to fill up the data? Well, you're in luck! And if you're using git as a version system as well, this is your day. :)

In the Sonar Advanced Parameter documentation you will find a System Property called sonar.projectDate. The property let you tell Sonar when in time the running analysis was ran.

By combining this property and what your version system does best, track changes to source, we can now play back the history of the project as far as Sonar is concerned.

This little Bash script illustrates the concept. To spell out what it does in human readable form:

@aappddeevv
aappddeevv / composing service layers in scala.md
Last active June 17, 2024 14:36
scala, cake pattern, service, DAO, Reader, scalaz, spring, dependency inejection (DI)

#The Problem We just described standard design issues you have when you start creating layers of services, DAOs and other components to implement an application. That blog/gist is here.

The goal is to think through some designs in order to develop something useful for an application.

#Working through Layers If you compose services and DAOs the normal way, you typically get imperative style objects. For example, imagine the following:

  object DomainObjects {
@aappddeevv
aappddeevv / slick sub-select with max value.md
Last active October 12, 2018 06:57
scala, slick, sub-select select, max column

I am learning slick. A bit of tough road initially. The blogs and other posts out there really help. This tutorial was especially helpful.

My domain was storing note objects in database and tracking revisions. Here's the table structure:

 class Notes(tag: Tag) extends Table[(Int, Int, java.sql.Timestamp, Boolean, Option[String])](tag, "Notes") {
    // some dbs cannot return compound primary key, so use a standard int
    def id = column[Int]("id", O.AutoInc, O.PrimaryKey)
    def docId = column[Int]("docId")
    def createdOn = column[java.sql.Timestamp]("createdOn")
    def content = column[Option[String]]("content")
@vladimirtsyupko
vladimirtsyupko / gist:10964772
Created April 17, 2014 08:32
Git force pull to overwrite local files
git fetch --all
git reset --hard origin/master
git pull origin master
@LeifW
LeifW / scalaz-stream-jdbc.scala
Last active August 29, 2015 14:01
scalaz-stream + jdbc
import java.sql.DriverManager
import scalaz.concurrent.Task
import scalaz.stream.io
import scalaz.stream.Process.End
class Query(query: String, chunkSize: Int) {
Class forName "org.postgresql.Driver"
val connection = DriverManager.getConnection(url, "username", "password")
val statement = connection.createStatement
// This will cause the postgres driver to create a cursor and give ResultSets of that size
@joergrathlev
joergrathlev / Demo.java
Created June 23, 2015 21:06
The IO monad (or something similar) in Java
import java.util.function.Function;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
public class Demo {
/**
* An IO operation that results in a value of type T.
@augbog
augbog / Free O'Reilly Books.md
Last active July 23, 2024 15:24
Free O'Reilly Books

Free O'Reilly books and convenient script to just download them.

Thanks /u/FallenAege/ and /u/ShPavel/ from this Reddit post

How to use:

  1. Take the download.sh file and put it into a directory where you want the files to be saved.
  2. cd into the directory and make sure that it has executable permissions (chmod +x download.sh should do it)
  3. Run ./download.sh and wee there it goes. Also if you do not want all the files, just simply comment the ones you do not want.
Upload files to Google Drive using Google Apps Script Web Apps and save records in Google Sheets.