Skip to content

Instantly share code, notes, and snippets.

Avatar

César Aguilera Cs4r

  • Málaga, Spain
View GitHub Profile
@Cs4r
Cs4r / clean_code.md
Created Jun 2, 2017 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin
View clean_code.md

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@Cs4r
Cs4r / .cvim
Last active Mar 9, 2017
my cVim settings
View .cvim
set nohud
set nosmoothscroll
set noautofocus
" Code blocks (see below for more info)
getIP() -> {{
httpRequest({url: 'http://api.ipify.org/?format=json', json: true},
function(res) { Status.setMessage('IP: ' + res.ip); });
}}
" Displays your public IP address in the status bar
@Cs4r
Cs4r / gist:e55bf303d62aa2a4fca2c1a40cfe7b00
Created Apr 2, 2016
Create a source from a collection with akka-streams
View gist:e55bf303d62aa2a4fca2c1a40cfe7b00
final Source<Integer, NotUsed> sourceOfNumbers = Source.from(
Arrays.asList(1,2,3)
);
@Cs4r
Cs4r / Test.java
Created Nov 6, 2012
Programa para testear y medir tiempos en el Algoritmo de resolucion de sudokus hexadecimales
View Test.java
//import java.io.BufferedWriter;
//import java.io.FileWriter;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
@Cs4r
Cs4r / gist:3996566
Created Nov 1, 2012
Sudoku Backtracking en Perl
View gist:3996566
#!/usr/bin/env perl
#
# bksudoku.pl
#
# Escrito por César Aguilera http://cosmobitsion.blogspot.com/
#
# Este programa es software libre, usted puede redistribuirlo y/o
# modificarlo bajo los términos de la GNU General Public License
# publicada por la Free Software Foundation, bien de la versión 2
# de la Licencia o cualquier versión posterior.
@Cs4r
Cs4r / gist:3996561
Created Nov 1, 2012
Sudoku en Python
View gist:3996561
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# sudoku.py
#
# Escrito por César Aguilera http://cosmobitsion.blogspot.com/
#
# REQUISITOS: Para ejecutar este programa deberá descargar el
# generador sudokus de David Bau a través de la dirección web:
# http://davidbau.com/downloads/sudoku.py y renombrarlo a
@Cs4r
Cs4r / my_pow.py
Created Jan 8, 2012
An elegant way to calculate a^n with positive integer values. O(log(n))
View my_pow.py
def my_pow(a,n):
"""Returns base raised to the power exponent."""
if n == 1:
return a
u = my_pow(a,n/2)
return a*u*u if n&1 else u*u
You can’t perform that action at this time.