Skip to content

Instantly share code, notes, and snippets.

@wojteklu
wojteklu / clean_code.md
Last active May 10, 2024 21:32
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

@okunishinishi
okunishinishi / Remove all git tags
Created March 8, 2014 03:12
Delete all git remote tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
@nitrix
nitrix / example.php
Created October 29, 2012 04:48
Google two-way authentification in PHP
<?php
include('g2w.php');
$initkey = 'PEHMPSDNLXIOG65R'; // set the inital key or use generate_secret_key() for a new one
$timestamp = G2W::get_timestamp();
$secretkey = G2W::base32_decode($initkey); // decode it into binary
$otp = G2W::oath_hotp($secretkey, $timestamp); // get current token
echo 'Init key: '.$initkey."\n";