Skip to content

Instantly share code, notes, and snippets.

View jrobinsonc's full-sized avatar
🎯
Focusing

Jose Robinson jrobinsonc

🎯
Focusing
View GitHub Profile
@jrobinsonc
jrobinsonc / check-db.md
Created September 21, 2018 13:24
WordPress snippet: Check DB with WP CLI

Check the DB of WordPress

Check using the number of tables.

#/bin/bash

while [ true ]
do
 # Number of actual tables in the database.
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& chmod +x /usr/local/bin/composer
<?php
function get_server_memory_usage() {
$free = shell_exec('free');
$free = (string)trim($free);
$free_arr = explode("\n", $free);
$mem = explode(" ", $free_arr[1]);
$mem = array_filter($mem);
$mem = array_merge($mem);
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)-[0-9]+\.(js|css)$ $1.$2 [L]
zend_extension=xdebug.so
xdebug.remote_enable = on
xdebug.remote_connect_back = on
xdebug.idekey = "vagrant"
xdebug.default_enable = 1
xdebug.remote_autostart = 0
xdebug.remote_port = 9000
xdebug.remote_handler=dbgp
xdebug.remote_log="/var/log/xdebug/xdebug.log"
xdebug.remote_host=10.0.2.2
@jrobinsonc
jrobinsonc / _readme.md
Created February 13, 2018 05:22 — forked from lambdahands/_readme.md
FlowType and CSS Modules

Huh?

So basically FlowType doesn't know about CSS Modules, a really handy way of dealing with the plagues of CSS in codebases (global variables and dependency wackiness mainly).

What WebPack allows us to do is "require" CSS files and use their class names:

import styles from "my_styles.css";
import React from "react";

Adding favicon to header:

add_action('wp_head', function () {
    printf('<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">');
});

Do logging programmatically

@jrobinsonc
jrobinsonc / php.sublime-build
Created October 18, 2017 15:53 — forked from fabiobruna/php.sublime-build
PHP Lint build system for Sublime Text 3
{
"cmd": ["php", "-l", "$file"],
"file_regex": "^.* in (...*?) on line ([0-9]*)",
"selector": "source.php"
}
@jrobinsonc
jrobinsonc / README.md
Last active October 15, 2018 12:33 — forked from Greg-Boggs/README.md
Drupal Site Building Best Practices

Better Drupal Building

  • Custom glue should be accomplished with configuration first and PHP code second.

Configuration Management and Dependencies

  • Use Composer (or Drush Make) to build your project and it's depencies.
  • Store your work in files.
  • Set your config directory above the webroot.
  • Sync UUIDs across all developers.

Theming

@jrobinsonc
jrobinsonc / PHP composer tools.md
Created September 8, 2017 03:03 — forked from davebarnwell/PHP composer tools.md
Global installation of PHP tools with Composer

Global installation of PHP tools with Composer

To install a composer package globally, you run the usual require command, but with the addition of the global modifier. So to install PHPUnit, you would run:

$ composer global require phpunit/phpunit
$ composer global require phpunit/dbunit
$ composer global require phing/phing
$ composer global require phpdocumentor/phpdocumentor
$ composer global require sebastian/phpcpd