Skip to content

Instantly share code, notes, and snippets.

@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 {
@17twenty
17twenty / simple_git.md
Created September 27, 2013 18:32
A Simple Git branching model

a simple git branching model

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

The gist

@hrj
hrj / calib.sh
Created September 14, 2013 11:28
Script to add red tint to the entire screen.
#!/bin/bash
# Call with a percentage value from 0 to 100
# 0 means only red, 50 means half of green and blue is shown through
# if you don't give any arguments the calibration is cleared
if [[ -z "$1" ]]; then
echo Clearing all calibrations
xcalib -clear
else
@willurd
willurd / web-servers.md
Last active May 14, 2025 19:48
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@n1k0
n1k0 / casper-google-suggest.md
Last active February 22, 2020 17:50
A simple CasperJS script to fetch google suggestions from a partial search

CasperJS Google Suggest

The script:

/*global casper:true*/
var casper = require('casper').create({
    pageSettings: {
        userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Firefox/31.0"
 }
#include<stdio.h>
#include<stdlib.h>
#include<sys/socket.h>
#include<features.h>
#include<linux/if_packet.h>
#include<linux/if_ether.h>
#include<errno.h>
#include<sys/ioctl.h>
#include<net/if.h>
#include<net/ethernet.h>
@BinRoot
BinRoot / MyData.hs
Created February 12, 2013 16:52
Haskell code used in Lecture 5 from http://shuklan.com/haskell/lec05.html
module MyData
(MetricUnit(..),
ImperialUnit(..),
Measurement(..),
convert)
where
data MetricUnit = Meter
| Liter
@nlinker
nlinker / gist:4243761
Created December 9, 2012 07:25
Scala cake pattern
abstract class Cake {
def top: String
def middle: String
def bottom: String
override def toString = top
}
trait Cherry { this: Cake =>
def top = "cherry on top of " + middle
}
@loicdescotte
loicdescotte / Forcomptran.md
Last active May 27, 2023 06:27
Scala for comprehension translation helper

Scala for comprehension translation helper

"For comprehension" is a another syntaxe to use map, flatMap and withFilter (or filter) methods.

yield keyword is used to aggregate values in the resulting structure.

This composition can be used on any type implementing this methods, like List, Option, Future...

@kmtr
kmtr / beans.xml
Created September 4, 2012 15:00
JavaEE6 Jetty CDI(Weld) JAX-RS(jersey)
<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
</beans>