Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:
Tea, Earl Grey, hot.

Jeff Geerling geerlingguy

:shipit:
Tea, Earl Grey, hot.
View GitHub Profile
@geerlingguy
geerlingguy / apple-tv-status.php
Last active Sep 23, 2020
Simple script to use the Ping PHP library and print a list of servers and their statuses. Written for a school that needs to track whether some local Apple TVs are active.
View apple-tv-status.php
<?php
/**
* @file
* Show the status of various Apple TVs.
*/
// Place Ping.php in the same folder as this script.
require_once('Ping.php');
@geerlingguy
geerlingguy / SonarDrupalKeyGenerator.php
Last active Sep 24, 2020
A simple PHP script to generate the XML necessary for Sonar to detect the Drupal Coder module's sniffs. See: https://drupal.org/node/2082563
View SonarDrupalKeyGenerator.php
<?php
/**
* @file
* Generate rules for Drupal Coding Standards Sniffs.
*
* SonarQube requires manually-entered PHP CodeSniffer rules if you use anything
* outside of the standard set of rules. In this case, there are a bunch of
* Drupal-specific sniffs that we'd like to use.
*
@geerlingguy
geerlingguy / crawler_detect.php
Created May 7, 2014
Detect crawlers/bots/spiders in PHP (simple and fast)
View crawler_detect.php
<?php
/**
* Check if the given user agent string is one of a crawler, spider, or bot.
*
* @param string $user_agent
* A user agent string (e.g. Googlebot/2.1 (+http://www.google.com/bot.html))
*
* @return bool
* TRUE if the user agent is a bot, FALSE if not.
@geerlingguy
geerlingguy / windows-environment.md
Created May 28, 2014
Windows 7 Environment Setup
View windows-environment.md

Windows 7 Environment Setup

I've had the misfortune of having to work on a Windows-based PC from time to time, and it takes a bit of time to figure out the right software required to configure a Windows workstation for proper web development. Additionally, since Windows is harder (if not impossible) to script via simple CM tools like Puppet or Ansible (and I have no desire to learn the vagaries of PowerShell, though some Windows-loving friends seem to think highly of it), I hate having to sit around googling links to get downloads of all the required apps.

Here's a simple list of all the software packages I install on Windows workstations to do development via Linux VMs (configured via Vagrant + VirtualBox):

View blinky.ino
/*
Blinky
Make it look like my Arduino is doing something nefarious.
*/
int led = 13;
void setup() {
pinMode(led, OUTPUT);
}
View keybase.md

Keybase proof

I hereby claim:

  • I am geerlingguy on github.
  • I am geerlingguy (https://keybase.io/geerlingguy) on keybase.
  • I have a public key whose fingerprint is 31B7 F9E1 C457 BDF5 C57B 59B3 FF8E 69CB D559 848E

To claim this, I am signing this object:

@geerlingguy
geerlingguy / php7.conf
Created May 31, 2015
Apache PHP mods-available Config File
View php7.conf
<FilesMatch ".+\.ph(p[3457]?|t|tml)$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch ".+\.phps$">
SetHandler application/x-httpd-php-source
# Deny access to raw php sources by default
# To re-enable it's recommended to enable access to the files
# only in specific virtual host or directory
Require all denied
</FilesMatch>
@geerlingguy
geerlingguy / post-slack-messages-on-interval.js
Created Nov 13, 2015
Post Slack messages on an interval - paste this into console on a Slack chat page
View post-slack-messages-on-interval.js
setInterval(function() {
jQuery('#message-input').val('ruby--');
jQuery('#message-form').submit();
jQuery('#message-input').val('game of shadows++');
jQuery('#message-form').submit();
}, 30 * 1000);
@geerlingguy
geerlingguy / extension-bookmarklet.js
Created Jan 10, 2016
JS bookmarklet - add an extra extension to the end of a domain
View extension-bookmarklet.js
function locationreplace(a, b) {
currentLocation = window.location.href;
newLocation = currentLocation.toString().replace(a, b);
document.location.href = newLocation;
}
locationreplace('.org', '.org.etc.etc');
@geerlingguy
geerlingguy / acsf_environment_detection.php
Created Apr 28, 2016
Acquia Cloud Site Factory Environment Detection
View acsf_environment_detection.php
<?php
/**
* Acquia Cloud Site Factory Environment detection examples.
*/
// This may require the ACSF module to be installed.
// @see https://www.drupal.org/project/acsf
$site settings = [
'site' => '',
'env' => '',
You can’t perform that action at this time.