Skip to content

Instantly share code, notes, and snippets.

View kingsloi's full-sized avatar

Kingsley Raspe kingsloi

View GitHub Profile
@benschwarz
benschwarz / index.html
Last active November 6, 2023 21:10
Using ARIA roles with <header>, <footer> and <aside>
<!doctype html>
<html>
<body>
<header role="banner">
<a href="/" rel="home">My company</a>
<nav role="navigation">
<a href="/about">About</a>
<a href="/contact">Contact</a>
</nav>
</header>
@christianhanvey
christianhanvey / modx-snippets.php
Last active June 14, 2023 13:02
Useful snippets for MODX Revo
Snippet: [[SnippetName]]
Chunk: [[$ChunkName]]
System Setting: [[++SettingName]]
TV: [[*fieldName/TvName]]
Link tag: [[~PageId? &paramName=`value`]]
Placeholder: [[+PlaceholderName]]
<?php
const Application = ((d) => {
const privateVariable = 'Private content'
const __private = {
cache: () => {
this.link = d.querySelector('.link')
},
bind: () => {
this.link.addEventListener('click', this.showContent, false)
@aras-p
aras-p / preprocessor_fun.h
Last active November 15, 2024 09:22
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
mkdir scrutinizer && cd scrutinizer
# Install tools
# - Scrutinizer and composer
wget http://scrutinizer-ci.com/scrutinizer.phar
curl -sS https://getcomposer.org/installer | php
# - All needed CI tools
php composer.phar require h4cc/phpqatools:~1.2
cp -p composer.phar vendor/bin/composer
@GaryRogers
GaryRogers / VagrantCentOS.md
Last active February 8, 2020 20:32
Provisioning Vagrant CentOS hosts
@Shelob9
Shelob9 / check_dev.php
Created August 25, 2014 02:18
Check if loading from .dev tld (ie is local environment) adapted from http://stackoverflow.com/a/3211416/1469799
<?php
function slug_check_dev() {
$urlParts = parse_url( htmlspecialchars("//$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]", ENT_QUOTES, 'UTF-8' ) );
$hostParts = explode('.', $urlParts[ 'host'] );
$hostParts = array_reverse( $hostParts );
if ( $hostParts[ 0 ] === 'dev' ) {
return true;
}
@nvanselow
nvanselow / gist:f00b890c921da937ddb6
Last active July 7, 2023 19:02
Installing Selenium on Laravel Homestead

Install Selenium and PhantomJS on Laravel Homestead

All commands are in the terminal.

  1. SSH into the Homestead Box - vagrant ssh from homestead directory
  2. Create a new folder for Selenium - mkdir selenium from the ~ directory
  3. Navigate to that folder - cd selenium
  4. Get Selenium - wget http://selenium-release.storage.googleapis.com/2.45/selenium-server-standalone-2.45.0.jar *Note: This link comes from copying the link on http://docs.seleniumhq.org/download/
  5. Install Java - sudo apt-get install openjdk-7-jre-headless

BEM with namespaces cheat sheet

  • o-, Object
    • abstrct; may be used in any number of (unrelated) places across the project
    • modifications have knock-on effects in a lot of other unrelated places
    • for “abstracting out the repetitive, shared, and purely structural aspects of a UI into reusable objects”
    • layout, wrappers, containers and other “skeletal aspects” of UI components
  • c-, Component
    • a concrete, implementation-specific piece of UI
  • modifications are detectable in the context you’re currently looking at
@mozillazg
mozillazg / supervisord.service
Last active December 1, 2023 12:59 — forked from tonyseek/supervisord.service
install and configure supervisord on centos 7.
[Unit]
Description=supervisord - Supervisor process control system for UNIX
Documentation=http://supervisord.org
After=network.target
[Service]
Type=forking
ExecStart=/bin/supervisord -c /etc/supervisord/supervisord.conf
ExecReload=/bin/supervisorctl reload
ExecStop=/bin/supervisorctl shutdown