Skip to content

Instantly share code, notes, and snippets.

View rockoo's full-sized avatar

Rok Nemet rockoo

View GitHub Profile
@rockoo
rockoo / custom-handler.php
Last active May 24, 2022 12:31
Custom error handler for stack trace Medium article
<?php
set_exception_handler( function(\Exception $e) {
$rows = "\n ========= \n";
$exception = sprintf(
"Exception: %s \n Origin: %s on line %s \n",
$e->getMessage(),
$e->getFile(),
$e->getLine()
);
@rockoo
rockoo / Example.php
Created April 30, 2020 19:27
Nonesenical example for an Medium article on Stack Traces
<?php
namespace Poker;
class Deck
{
protected $deck = null;
public function __construct(int $cards = 52)
{
@rockoo
rockoo / style
Created April 28, 2020 19:01
style
/* ATTENTION! This file was generated automatically! Don&#039;t change it!!!
----------------------------------------------------------------------- */
body {
font-family:"gandhi",serif;
font-size:1rem;
font-weight:400;
font-style:normal;
line-height:1.6em;
text-decoration:none;
@rockoo
rockoo / index.php
Created March 25, 2020 16:36
Example script to test debugger
<?php
$countries = ['Slovenia', 'Austria', 'Germany', 'Italy', 'France', 'Spain'];
foreach ($countries as $country) {
echo $country . ' ';
}
@rockoo
rockoo / docker-compose.yml
Created March 25, 2020 16:12
Docker compose file
version '2'
services:
web:
image: base-dev-image:v1.0.0
ports:
- "8000:80"
volumes:
- ./:/var/www/html
environment:
XDEBUG_CONFIG: "remote_host=host.docker.internal idekey=PHPSTORM"
@rockoo
rockoo / Dockerfile
Created March 25, 2020 16:06
Base development docker image
FROM php:7.4-apache
WORKDIR /tmp
RUN apt update \
&& apt install libonig-dev unzip
RUN pecl install xdebug-2.9.0 \
&& docker-php-ext-enable xdebug
RUN echo "xdebug.remote_enable=1" >> /usr/local/etc/php/php.ini
RUN curl -o composer-setup.php https://getcomposer.org/installer \
&& php composer-setup.php \
&& mv composer.phar /usr/bin/composer \
@rockoo
rockoo / us-phone-numbers.json
Created November 2, 2016 11:50
List of US area codes coresponding to a state
[{"code":"201","state":"New Jersey"},{"code":"202","state":"District of Columbia"},{"code":"203","state":"Connecticut"},{"code":"204","state":"Manitoba"},{"code":"205","state":"Alabama"},{"code":"206","state":"Washington"},{"code":"207","state":"Maine"},{"code":"208","state":"Idaho"},{"code":"209","state":"California"},{"code":"210","state":"Texas"},{"code":"212","state":"New York"},{"code":"213","state":"California"},{"code":"214","state":"Texas"},{"code":"215","state":"Pennsylvania"},{"code":"216","state":"Ohio"},{"code":"217","state":"Illinois"},{"code":"218","state":"Minnesota"},{"code":"219","state":"Indiana"},{"code":"224","state":"Illinois"},{"code":"225","state":"Louisiana"},{"code":"228","state":"Mississippi"},{"code":"229","state":"Georgia"},{"code":"231","state":"Michigan"},{"code":"234","state":"Ohio"},{"code":"239","state":"Florida"},{"code":"240","state":"Maryland"},{"code":"242","state":"Bahamas"},{"code":"246","state":"Barbados"},{"code":"248","state":"Michigan"},{"code":"250","state":"Britis
@rockoo
rockoo / bookmarklet.html
Created August 19, 2015 09:15
Bookmarklet example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Redactor Project</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="respond.js"></script>
<style type="text/css">