Skip to content

Instantly share code, notes, and snippets.

View starise's full-sized avatar
Damn fine coffee

Andrea Brandi starise

Damn fine coffee
View GitHub Profile
@starise
starise / Vagrantfile
Last active August 29, 2015 14:01
Windows provisioner for bedrock-ansible
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.require_version '>= 1.5.1'
Vagrant.configure('2') do |config|
config.vm.box = 'roots/bedrock'
config.vm.network :private_network, ip: '192.168.50.5'
config.vm.hostname = 'example.dev'
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: Plugin Class Demo
* Description: How I am using the base class in plugins.
* Plugin URI:
* Version: 2012.09.29
* Author: Thomas Scholz
* Author URI: http://toscho.de
* License: GPL
* Text Domain: plugin_unique_name
@starise
starise / wp-autoloader.php
Created February 2, 2015 03:27
Wordpress autoloader for plugins and themes
<?php
/**
* Autoloader for WordPress plugins and themes
* http://wordpress.stackexchange.com/a/66484
*/
spl_autoload_register(__NAMESPACE__ . '\\autoload');
function autoload($cls)
{
$cls = ltrim($cls, '\\');
if(strpos($cls, __NAMESPACE__) !== 0)
@starise
starise / wp-plugin-skeleton.php
Last active April 28, 2021 09:20
WordPress Plugin Skeleton
<?php
/**
* Plugin Name: Plugin Skeleton
* Description: Static Base plugin for WordPress.
* Version: 1.0.0
* Author: starise
* Author URI: http://stari.se
* License: GPL
*/
@starise
starise / bootstrap.php
Last active August 29, 2015 14:14
Wordpress Plugin Autloader
<?php
class vendorAutoloader
{
const BASENAME = 'vendor';
const BASESRC = 'src';
/**
* Static loader method
* @param string $class
@starise
starise / md.php
Last active August 29, 2015 14:15 — forked from swalkinshaw/md.php
<?php
namespace Roots\Bedrock;
use League\CommonMark\CommonMarkConverter;
class MarkdownPosts {
const POST_OPTION = 'roots/bedrock/markdown_posts';
const IS_MD_META = 'roots/bedrock/is_markdown';
@starise
starise / extras.php
Created November 2, 2015 19:19 — forked from E-VANCE/extras.php
JSON sitemap generation for use with UnCSS (+ Sage theme)
<?php
/**
* Generate JSON sitemap for use with UnCSS
*/
function show_sitemap() {
if (WP_ENV === 'development' && isset($_GET['show_sitemap'])) {
@starise
starise / git-normalize.md
Last active September 13, 2017 21:56
Proper way to handle line endings in Windows

Best way to handle line endings in Windows

Set core.autocrlf to false and default line endings to LF globally for git:
git config --global core.autocrlf false
git config --global core.eol lf
Set text=auto in your .gitattributes for all files:
@starise
starise / update-trellis.md
Created September 14, 2017 23:27
How to keep your Trellis updated

> How did you setup your projects?

More less the same as the subtrees method, but:

  • trellis and bedrock are 2 different git repos
  • keep .git despite the doc tells you to delete it
  • i also have a branch (tangrufus/trellis@project-template) to keep all my common customization to start a project
  • 3 git remotes for every project:
    • roots/trellis
    • tangrufus/trellis
@starise
starise / enable-bash.ps1
Created September 24, 2017 10:21 — forked from yuntsewu/enable-bash.ps1
On Windows 10, right click and press "Run with PowerShell" will install "Windows Subsystem for Linux" on your system. After it completes, Win+R -> bash will prompt you for the initialization.
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit }
# Create AppModelUnlock if it doesn't exist, required for enabling Developer Mode
$RegistryKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
if (-not(Test-Path -Path $RegistryKeyPath)) {
New-Item -Path $RegistryKeyPath -ItemType Directory -Force
}
# Add registry value to enable Developer Mode
New-ItemProperty -Path $RegistryKeyPath -Name AllowDevelopmentWithoutDevLicense -PropertyType DWORD -Value 1