Skip to content

Instantly share code, notes, and snippets.

View defaultpage's full-sized avatar
:octocat:
Ok

Default User defaultpage

:octocat:
Ok
  • Ukraine
View GitHub Profile
@hkdobrev
hkdobrev / class-order.php
Last active April 11, 2025 09:57
PHP convention for the order in a class.
<?php namespace Vendor\Library;
use Another\Vendor\Library\ClassName;
abstract class ClassName extends AnotherClass implements Countable, Serializable
{
const CONSTANTS = 'top';
use someTrait, anotherTrait {
anotherTrait::traitMethod insteadof someTrait;
@vensko
vensko / router.php
Last active September 27, 2017 10:57
router.php
<?php
$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$uri = urldecode($uri);
if ($uri === '/' || isset($_SERVER['SCRIPT_FILENAME']) || file_exists($_SERVER['DOCUMENT_ROOT'].$uri)) {
return false;
} else {
if (file_exists(__DIR__.$uri)) {
if (is_dir(__DIR__.$uri)) {
@irazasyed
irazasyed / laravel-version.php
Last active October 10, 2017 08:16
PHP: Check if Laravel version is 4 in Service Provider. To be used in Service Providers.
<?php
/**
* Laravel Version Check
*
* @return bool
*/
private function isLaravel4()
{
return version_compare(get_class($this->app) . '::VERSION', '5', '<');
@JamesMessinger
JamesMessinger / IndexedDB101.js
Last active April 14, 2025 16:34
Very Simple IndexedDB Example
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;
// Open (or create) the database
var open = indexedDB.open("MyDatabase", 1);
// Create the schema
open.onupgradeneeded = function() {
var db = open.result;
var store = db.createObjectStore("MyObjectStore", {keyPath: "id"});
# All the command used here : http://blog.madrzejewski.com/faire-fonctionner-curl-en-https-dans-un-environnement-php-fpm-chroote
# Centos 7.1, the libs named may changed in the future, so don't just copy/paste and check on your system first
# First example, chroot bash
mkdir chroot_bash
mkdir -p chroot_bash/usr/bin
cp /usr/bin/bash chroot_bash/usr/bin
chroot chroot_bash/ bash
chroot: failed to run command ‘bash’: No such file or directory
@daredude
daredude / docker-clear.bat
Created June 5, 2016 10:53
delete all docker container and images on windows
@echo off
FOR /f "tokens=*" %%i IN ('docker ps -aq') DO docker rm %%i
FOR /f "tokens=*" %%i IN ('docker images --format "{{.ID}}"') DO docker rmi %%i
@telless
telless / .gitconfig
Last active September 9, 2021 16:03
typical gitconfig
[user]
name = telless
email = [email protected]
[core]
excludesfile = ~/.gitignore_global
editor = vscode
# set autocrlf = true for Windows
autocrlf = input
safecrlf = true
[push]
@maks-rafalko
maks-rafalko / books-for-php-developer.md
Last active March 19, 2025 19:21
Books for PHP developer from Junior to Senior

Литература для рекомендации

Junior

  • Документация PHP - http://php.net/
  • http://www.phptherightway.com/
  • Мэт Зандстра "PHP. Объекты, шаблоны и методики программирования" ISBN 978-5-8459-1922-9
  • Мартин. Чистый код.
@kefzce
kefzce / logslaravel.sh
Created August 19, 2018 11:18 — forked from jakebathman/logslaravel.sh
Tail Laravel logs and filter out the stack traces
tail -f -n 450 storage/logs/laravel*.log \
| grep -i -E \
"^\[\d{4}\-\d{2}\-\d{2} \d{2}:\d{2}:\d{2}\]|Next [\w\W]+?\:" \
--color
@naesean
naesean / jsonapi_oas.yml
Last active May 9, 2025 06:06
OpenAPI 3.0 schemas that comply with the JSON:API 1.0 specification
JSONAPIObject:
description: Includes the current JSON:API version for this specification as well as optional meta information
type: object
required:
- version
properties:
version:
type: string
default: '1.0'
example: '1.0'