Skip to content

Instantly share code, notes, and snippets.

View christian-fei's full-sized avatar
🌴
exploring ideas

Christian christian-fei

🌴
exploring ideas
View GitHub Profile
@christian-fei
christian-fei / gist:7747009
Last active December 30, 2015 00:08
minimal grid system
*, *:before, *:after{
margin: 0;
padding: 0;
box-sizing:border-box;
}
.row{
width: 100%;
overflow: hidden;
}
.row > *{
@christian-fei
christian-fei / nginx.conf
Last active August 29, 2015 14:06 — forked from thoop/nginx.conf
# Change YOUR_TOKEN to your prerender token and uncomment that line if you want to cache urls and view crawl stats
# Change example.com (server_name and in the rewrite rule) to your website url
# Change /path/to/your/root to the correct value
server {
listen 80;
server_name example.com;
root /path/to/your/root;
index index.html;
@christian-fei
christian-fei / xpex.md
Last active August 29, 2015 14:07
Extreme Programming Explained

Quali sono i rischi di un progetto software?

  • il software non rispecchia i requisiti del business per mancanza di comunicazione e costante feedback. Non solve il problema del business.
  • dopo la messa in produzione il problema da risolvere lato business è cambiato.
  • il costo di modifica a seguito di un cambiamento diventa elevato, se non rischioso perchè vari componenti del software sono connessi tra di loro ed i test non sono sufficienti per garantire la stabilità del sistema.
  • i programmatori che lavorano da mesi sullo stesso progetto (da soli) si sono stancati del progetto e manca l'entusiasmo
  • feature prioritarie lato business non vengono consegnate, o dopo feature secondarie
  • le date di release non vengono mantenute dai programmatori, perchè il progetto è sfuggito di mano
  • il progetto viene cancellato dopo varie release non centrate
  • il progetto diventa complicato, difficile da mantenere. e logicamente "non c'è tempo per rifattorizzare"

Codice difficile da testare

Codice è difficile da testare quando si ha parti di codice che:

  • ha variabili (stato) globali, Singletons
  • metodi statici che forzano test su grandi parti di codice, che potenzialmente ha una connessione al database etc.
  • troppi conditionals

Come si scrive codice testabili

@christian-fei
christian-fei / notes.md
Last active August 29, 2015 14:23
mock roles not objects
export default function route(name, config={}) {
let {url} = config
url = url || `/${name}`
url = normalizeRouteUrl(url)
const normalizedRouteName = normalizeRouteName(name)
const nameCap = normalizedRouteName[0].toUpperCase() + normalizedRouteName.slice(1)
const controller = `${nameCap}Ctrl as vm`
const templateUrl = `controllers/${nameCap}Ctrl.html`
return {
name,
describe_time :: Int -> String
describe_time sec = describe_time_rec (0, 0,0,0) sec
describe_time_rec :: (Int, Int, Int, Int) -> Int -> String
describe_time_rec acc@(days, hours,minutes,seconds) rem
| rem >= 86400 = describe_time_rec (days + 1, hours,minutes,seconds) (rem - 86400)
| rem >= 3600 = describe_time_rec (days, hours + 1,minutes,seconds) (rem - 3600)
| rem >= 60 = describe_time_rec (days, hours,minutes + 1,seconds) (rem - 60)
| rem < 60 = describe_time_rec (days, hours, minutes, rem) 0
| rem == 0 = (show days) ++ " DAYS " ++ (show hours) ++ " HOURS " ++ (show minutes) ++ " MINUTES " ++ (show seconds) ++ " SECONDS"

Keybase proof

I hereby claim:

  • I am christian-fei on github.
  • I am christianfei (https://keybase.io/christianfei) on keybase.
  • I have a public key ASCL36GRLuHLlZ-3tfN7lLNf2M-rmatrERU0ITGNK0wrwAo

To claim this, I am signing this object: