Skip to content

Instantly share code, notes, and snippets.

Avatar

Maciej Sobaczewski Sobak

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

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
View PeselValidate.rb
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 Dec 28, 2014
Innovative implementation of factorial. Result of boredom and too much free time.
View factorial.php
<?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;");
}
You can’t perform that action at this time.