Skip to content

Instantly share code, notes, and snippets.

@gwagroves
gwagroves / gist:cf73cdaade16d52d6ca3
Created September 16, 2014 14:36
SQL ready list of countries, nationalities, and collective nouns
('Abkhazia', 'Abkhazian', 'Abkhazians');
('Afghanistan', 'Afghan', 'Afghans');
('Albania', 'Albanian', 'Albanians');
('Algeria', 'Algerian', 'Algerians');
('American Samoa', 'American Samoan', 'American Samoans');
('Andorra', 'Andorran', 'Andorrans');
('Angola', 'Angolan', 'Angolans');
('Anguilla', 'Anguillan', 'Anguillans');
('Antigua and Barbuda', 'Antiguan', 'Antiguans');
('Argentina', 'Argentinian', 'Argentinians');
@gwagroves
gwagroves / gist:03546aa1ccd8b23d6f49
Created February 16, 2015 15:37
Phinx: Run migration from inside PHP script
use Phinx\Config\Config;
use Phinx\Migration\Manager;
use Symfony\Component\Console\Output\NullOutput;
$migrationspath = 'path/to/migrations/folder';
$config = new Config(array(
'paths' => array(
'migrations' => $migrationspath
),
@gwagroves
gwagroves / gist:abd22a02e5b3352a8c98
Created February 23, 2015 10:10
Find out which user apache is running as
ps aux | egrep '(apache|httpd)'
@gwagroves
gwagroves / gist:b0c2b1a4d26e8b9b0f9e
Last active August 29, 2015 14:19
wordpress dev stack

Stack

Theme

  • Twig templates
  • Theme architecture
    • All theme functions as namespaced classes
@gwagroves
gwagroves / gist:518de4c2b262acac5184
Created June 23, 2015 09:41
clearfix SASS mixin
// Gives an element that only contains floated elements its "natural" height
// (Without using overflow: hidden)
@mixin clearfix {
&:after {
content: "";
display: table;
clear: both;
}
}
<?php
function doTest($value) {
return $value === FALSE || is_null($value);
}
var_dump(doTest(''));
var_dump(doTest(0));
var_dump(doTest(null));
var_dump(doTest(FALSE));
?>
@gwagroves
gwagroves / style-placeholder.css
Created December 9, 2015 08:26
CSS to style placeholder text cross-browser
::-webkit-input-placeholder { /* WebKit, Blink, Edge */
color: #fff;
}
:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
color: #fff;
opacity: 1;
}
::-moz-placeholder { /* Mozilla Firefox 19+ */
color: #fff;
opacity: 1;
@gwagroves
gwagroves / PhpExtensionCheckStrategy.php
Created April 23, 2016 06:15
Rocketeer PHP check strategy replacement
<?php
/**
* This is a drop-in replacement for the default PhpStrategy.
*
* Instead of checking for `mcrypt` as a required extension, it checks for PHP extensions required in composer.json
* (e.g. `ext-mcrypt`)
*
* - Save the file as `.rocketeer/strategies/PhpCheckStrategy.php`
* - Change your strategy setting from 'Php' to `PhpExtensionCheck`
*
@gwagroves
gwagroves / content.md
Last active October 3, 2016 15:49
Drupal 8 hook arguments
$content[field_machine_name] =>
  0,
  1,
  2,
  #theme,
  #title,
  #label_display,
  #view_mode,
 #language,
@gwagroves
gwagroves / no-scroll.css
Created October 7, 2016 07:48
Prevent body scrolling on iOS
/* http://stackoverflow.com/a/19054794/698511 */
body.no-scroll {
left: 0;
-webkit-overflow-scrolling: touch;
position: fixed;
top: 0;
width: 100%;
}