Skip to content

Instantly share code, notes, and snippets.

View dejwid's full-sized avatar

Dawid Paszko dejwid

  • Stockholm, Sweden
View GitHub Profile
@dejwid
dejwid / letters.php
Last active February 28, 2018 09:33
Letters class example with exceptions and api message returns
<?php
class Letters{
private function getLetter($letter)
{
// get a ketter from the database
// bla bla blatriming, and geting for db
$letter = getFromDB(trim($letter));
if (!$letter) throw new \LetterException('Letter "'.$letter.'" was not found in the database');
return $letter;
@dejwid
dejwid / test.js
Last active February 8, 2017 21:22
Why i love es6
var sum = function(a,b) {
return a+b;
};
var sum (a,b) => a+b;
var square = function(a) {
return a*a;
<?php
$soundex = [
'sz' => 's',
'cz' => 'c',
'ch' => 'h',
'ó' => 'u',
'ą' => 'o',
'ł' => 'l',
'dź' => 'z',