Skip to content

Instantly share code, notes, and snippets.

View santerref's full-sized avatar

Francis Santerre santerref

View GitHub Profile
@santerref
santerref / autoload.php
Last active October 18, 2016 10:11
WordPress autoloader that respects PHP coding standards for plugin.
<?php
spl_autoload_register( function ( $class ) {
// project-specific namespace prefix
$prefix = 'my_plugin\\';
// base directory for the namespace prefix
$base_dir = __DIR__ . '/includes/';
@santerref
santerref / sync.sh
Last active April 12, 2021 17:20
Simple bash script to synchronize your WordPress dev (local) with your staging or production.
#/bin/bash
REMOTE_URL="https://staging.example.com"
LOCAL_URL="http://example.dev"
REMOTE_PATH="/home/staging_example/public_html"
LOCAL_PATH="/var/www/example.dev"
SSH_HOST="[email protected]"
@santerref
santerref / create-administrator-account.php
Last active November 30, 2016 19:06
Create an administrator account within Drupal 7 SimpleTest.
<?php
class TrashTestCase extends DrupalWebTestCase {
# [...]
public function testAdminContentNodesList() {
# Administrator account
$permissions = module_invoke_all('permission');
$permissions = array_keys($permissions);
@santerref
santerref / replace.sh
Created December 1, 2016 20:05
Replace all underscores with dashes.
#/bin/bash
for file in *; do mv "$file" `echo $file | tr '_' '-'` ; done
@santerref
santerref / disable-vagrant-time-sync.sh
Created February 6, 2017 15:22 — forked from X0nic/disable-vagrant-time-sync.sh
Disable vagrant time sync
#List vms
VBoxManage list vms
#get status of time sync
VBoxManage getextradata <vm-name> VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled
#NOTE: Make sure to restart the VM after changing these settings.
#disable time sync
VBoxManage setextradata <vm-name> VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled 1
@santerref
santerref / slugify.sh
Created June 1, 2017 19:43 — forked from ronanguilloux/slugify.sh
batch in bash to replace accents in filenames
#! /bin/bash
#
# slugify.sh by Ronan
#
# Distributed under terms of the MIT license.
#
for file in *.mp4; do
filename=${file%.*}
@santerref
santerref / mock-file-dropzone.js
Created November 23, 2017 15:22
Mock DropzoneJS file
var mock_file = {name: 'myfile.png', size: 10000};
mock_file.status = Dropzone.SUCCESS;
mock_file.accepted = true;
this.emit("addedfile", mock_file);
this.emit("complete", mock_file);
this.files.push(mock_file);
@santerref
santerref / views-view-unformatted.html.twig
Created April 11, 2018 15:20
Template pour les étapes
{#
/**
* @file
* Theme override to display a view of unformatted rows.
*
* Available variables:
* - title: The title of this group of rows. May be empty.
* - rows: A list of the view's row items.
* - attributes: The row's HTML attributes.
* - content: The row's content.
@santerref
santerref / ResetDefaultValues.php
Created May 30, 2018 02:01 — forked from kayintveen/ResetDefaultValues.php
Magento scripts that resets all products "use default values" setting of the admin store view. This script was created for a site that had thousands of products with deselected "Use Default Values" checkboxes in differente store-views
<?php
// Author: @kayintveen
// Credits: Microdesign B.V
// Created November 2015
//=====================================
// Enable Error Reporting
error_reporting(E_ALL);
ini_set('display_errors', '1');