Skip to content

Instantly share code, notes, and snippets.

View Sobak's full-sized avatar
🇵🇱

Maciej Sobaczewski Sobak

🇵🇱
View GitHub Profile
@Sobak
Sobak / phpdoc-svn-git-checklist.md
Last active June 19, 2018 04:54
Basic checklist for migrating the PHP Manual from SVN to Git

PHP Manual's SVN->Git transition status

Theory/assumptions

Most of the current workflow remains unchanged. The notable changes include:

  1. Switching from SVN sequential revision number in EN-Revision to Git hashes. It means we need to run the migration script on each of the translations to port that EN-Revision value and make it understandable for the tooling
  2. Dropping the use of $Revision$ (so whole top XML comments) in the English
class PeselValidate
@@weights = [1, 3, 7, 9, 1, 3, 7, 9, 1, 3, 1]
def initialize(str1)
@pesel = str1
end
def validate
numbers = @pesel.split(//).map(&:to_i)
sum = 0
@Sobak
Sobak / factorial.php
Created December 28, 2014 21:56
Innovative implementation of factorial. Result of boredom and too much free time.
<?php
function factorial($num) {
return eval('return '.implode(range(1, $num), '*').';');
}
// more readable form
function factorial2($num) {
$operation = implode(range(1, $num), '*');
return eval("return $operation;");
}