Skip to content

Instantly share code, notes, and snippets.

strarsis

Block or report user

Report or block strarsis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@strarsis
strarsis / example.blade.php
Created Feb 12, 2019
ACF Flexible fields with blade/sage9
View example.blade.php
<?php
@while(have_rows('flexible_field', $post->ID)) @php(the_row())
@while(have_rows('nested_field', $post->ID)) @php(the_row())
get_sub_field('some_field')
@endwhile
@endwhile
@strarsis
strarsis / example.php
Created Feb 3, 2019
Set ACF Free + ACF PRO Google Maps API key in WordPress (plugin) (Bedrock based WordPress installation)
View example.php
<?php
// Authorize API for project:
// https://console.developers.google.com/apis/api/places_backend?project=_
// Uses GOOGLE_API_KEY environment variable (WordPress Bedrock dotenv)
$google_api_key = getenv('GOOGLE_API_KEY');
if($google_api_key !== false and !empty($google_api_key)) {
View vagrant.log
INFO global: Vagrant version: 2.2.3
INFO global: Ruby version: 2.4.4
INFO global: RubyGems version: 2.6.14.1
INFO global: VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1"
INFO global: VAGRANT_WSL_WINDOWS_ACCESS_USER_HOME_PATH="[redacted]/trellis"
INFO global: VAGRANT_EXECUTABLE="/opt/vagrant/embedded/gems/2.2.3/gems/vagrant-2.2.3/bin/vagrant"
INFO global: VAGRANT_INSTALLER_EMBEDDED_DIR="/opt/vagrant/embedded"
INFO global: VAGRANT_INSTALLER_ENV="1"
INFO global: VAGRANT_INSTALLER_VERSION="2"
INFO global: VAGRANT_LOG="debug"
@strarsis
strarsis / child-theme.css
Created Sep 20, 2018
twentyseventeen child theme: Keep navigation menu for smaller breakpoints
View child-theme.css
@media screen and (min-width: 38em) { /* default is 48em */
/* Navigation */
.navigation-top {
bottom: 0;
font-size: 14px;
font-size: 0.875rem;
left: 0;
position: absolute;
View test.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@strarsis
strarsis / dumprequest.php
Created Apr 16, 2018 — forked from magnetikonline/dumprequest.php
PHP script to dump full HTTP request to file (method, HTTP headers and body).
View dumprequest.php
<?php
// https://gist.github.com/magnetikonline/650e30e485c0f91f2f40
class DumpHTTPRequestToFile {
public function execute($targetFile) {
$data = sprintf(
"%s %s %s\n\nHTTP headers:\n",
$_SERVER['REQUEST_METHOD'],
@strarsis
strarsis / test.min.svg
Last active Apr 1, 2018
svgo issue (svgo --multipass --pretty --enable=inlineStyles -i test.svg -o test.min.svg)
View test.min.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@strarsis
strarsis / dom-insert-after.php
Created Mar 26, 2018 — forked from deathlyfrantic/dom-insert-after.php
why doesn't the DOM spec include an insertAfter method, srsly guys
View dom-insert-after.php
<?php
/** Inserts a new node after a given reference node. Basically it is the complement to the DOM specification's
* insertBefore() function.
* @param \DOMNode $newNode The node to be inserted.
* @param \DOMNode $referenceNode The reference node after which the new node should be inserted.
* @return \DOMNode The node that was inserted.
*/
function insertAfter(\DOMNode $newNode, \DOMNode $referenceNode)
{
if($referenceNode->nextSibling === null) {
@strarsis
strarsis / .bashrc
Created Mar 16, 2018
Vagrant on WSL (Bash on Windows)
View .bashrc
# Vagrant
export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1"
export PATH=$PATH:/mnt/c/Program\ Files/Oracle/VirtualBox
export VAGRANT_WSL_WINDOWS_ACCESS_USER_HOME_PATH="/mnt/c/Users/<Windows Username>"
@strarsis
strarsis / wpdb-transactions
Created Mar 14, 2018 — forked from nciske/wpdb-transactions
MySQL database transaction, using the WordPress database object $wpdb. Requires the InnoDB table format.
View wpdb-transactions
<?php
global $wpdb;
// Start Transaction
$wpdb->query( "START TRANSACTION" );
// Do some expensive/related queries here
//$wpdb->query("DELETE FROM table WHERE form_id = '1' ");
//$wpdb->query("DELETE FROM data WHERE form_id = '1' ");
// set $error variable value in error handling after $wpdb modifications
You can’t perform that action at this time.