Skip to content

Instantly share code, notes, and snippets.

View nr1q's full-sized avatar

Enrique nr1q

View GitHub Profile
@hkdobrev
hkdobrev / class-order.php
Last active September 7, 2023 09:08
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;
@ryansechrest
ryansechrest / php-style-guide.md
Last active May 5, 2024 18:00
PHP style guide with coding standards and best practices.

PHP Style Guide

All rules and guidelines in this document apply to PHP files unless otherwise noted. References to PHP/HTML files can be interpreted as files that primarily contain HTML, but use PHP for templating purposes.

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Most sections are broken up into two parts:

  1. Overview of all rules with a quick example
  2. Each rule called out with examples of do's and don'ts
@kpeatt
kpeatt / gist:5154680
Last active November 7, 2019 23:29 — forked from tvandervossen/gist:1231476
Viewport sizes for iPad, iPhone 4 and under, and iPhone 5 and up.
iPad (Actual pixels in brackets)
1024 × 690 (2048 x 1380) In landscape on iOS 4.3
1024 × 672 (2048 x 1344) In landscape on iOS 5
768 × 946 (1536 x 1892) In portrait on iOS 4.3
768 × 928 (1536 x 1856) In portrait on iOS 5
1024 × 660 (2048 x 1320) Always showing bookmarks bar in landscape on iOS 4.3
1024 × 644 (2048 x 1288) Always showing bookmarks bar in landscape on iOS 5
768 × 916 (1536 x 1832) Always showing bookmarks bar in portrait on iOS 4.3
@wpscholar
wpscholar / functions.php
Last active March 1, 2021 13:26
Enqueueing IE conditional stylesheets in WordPress the right way
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
/**
* Example callback function that demonstrates how to properly enqueue conditional stylesheets in WordPress for IE.
* IE10 and up does not support conditional comments in standards mode.
*
* @uses wp_style_add_data() WordPress function to add the conditional data.
* @link https://developer.wordpress.org/reference/functions/wp_style_add_data/
window.addEventListener('load', function() {
var section = document.querySelector('div.main'),
args = document.querySelector('div.arguments'),
controls = document.querySelector('.controls'),
image = args.querySelector('img'),
video = args.querySelector('video'),
log = $('log'),
useBloomX = true,
useBloomY = true,
useBlending = true;
@jasonm23
jasonm23 / xterm-256color.svg
Last active February 11, 2024 12:33
Xterm 256color mode color chart, organised into sections. (used on Wikipedia/xterm)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@spicycode
spicycode / tmux.conf
Created September 20, 2011 16:43
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000