Skip to content

Instantly share code, notes, and snippets.

View jelera's full-sized avatar

Jose Elera jelera

View GitHub Profile
@wojteklu
wojteklu / clean_code.md
Last active June 29, 2024 08:22
Summary of 'Clean code' by Robert C. Martin

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

@jelera
jelera / timestamp.vim
Last active May 10, 2020 17:20 — forked from rkumar/timestamp.vim
It auto updates the timestamp in lines within the 20 first lines, matching "Last modified, Updated, Changed, etc."
" Append this to your vimrc file
"""""""""""""""""""""""""""""""""
" auto-update the timestamp right before saving a file
" The Timestamp format is : Sat 07 Dec 2013 12:51:00 AM CST
" Within the 20 first lines, the matched lines are :
" Last [Cc]hange(d)
" Changed
" Last [Mm]odified
" Modified
" Last [Uu]pdate(d)
@jelera
jelera / code_comment_banner.vim
Created November 25, 2013 05:53
Code Comment Banners For Vim (Inspired in Textmate)
autocmd FileType vim map <leader>cb I" <ESC>A "<DEL><ESC>yyp0lv$hhr-yykPjj
autocmd FileType python,perl,ruby,sh,zsh map <leader>cb I# <ESC>A #<ESC>yyp0lv$hhr-yykPjj
autocmd FileType javascript,php,c,cpp,css map <leader>cb I/* <ESC>A */<ESC>yyp0llv$r-$hc$*/<ESC>yykPjj
@djcp
djcp / Debian Jessie
Last active July 3, 2022 18:03
ubuntu / debian /etc/os-release files - and there was much gnashing of teeth and rending of flesh. . .
PRETTY_NAME="Debian GNU/Linux jessie/sid"
NAME="Debian GNU/Linux"
ID=debian
ANSI_COLOR="1;31"
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support/"
BUG_REPORT_URL="http://bugs.debian.org/"
@timss
timss / python273_install.sh
Last active November 18, 2022 05:33
Python 2.7.3 altinstall script for CentOS 5
#!/bin/bash
#---------------------------------------#
# Python 2.7.3 Install on CentOS 5 #
# https://gist.github.com/timss/5122008 #
# #
# Installs to /usr/local/{bin,lib} #
# Seperate from system default #
# /usr/bin/python(2.4) #
#---------------------------------------#
@rkumar
rkumar / timestamp.vim
Created November 29, 2012 04:54
timestamp auto-updating in files
" Add this to your vimrc file
" auto-update "Last update: " if present whenever saving file
autocmd! BufWritePre * :call s:timestamp()
" to update timestamp when saving if its in the first 5 lines of a file
function! s:timestamp()
let pat = '\(Last update\s*:\s*\).*'
let rep = '\1' . strftime("%Y-%m-%d %H:%M")
call s:subst(1, 5, pat, rep)
endfunction
@malarkey
malarkey / Contract Killer 3.md
Last active May 24, 2024 23:38
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@jfarmer
jfarmer / 01-truthy-and-falsey-ruby.md
Last active April 16, 2024 03:40
True and False vs. "Truthy" and "Falsey" (or "Falsy") in Ruby, Python, and JavaScript

true and false vs. "truthy" and "falsey" (or "falsy") in Ruby, Python, and JavaScript

Many programming languages, including Ruby, have native boolean (true and false) data types. In Ruby they're called true and false. In Python, for example, they're written as True and False. But oftentimes we want to use a non-boolean value (integers, strings, arrays, etc.) in a boolean context (if statement, &&, ||, etc.).

This outlines how this works in Ruby, with some basic examples from Python and JavaScript, too. The idea is much more general than any of these specific languages, though. It's really a question of how the people designing a programming language wants booleans and conditionals to work.

If you want to use or share this material, please see the license file, below.

Update