Skip to content

Instantly share code, notes, and snippets.

@nicolasembleton
nicolasembleton / restart_bluetooth.sh
Last active Jun 9, 2021
Restart Bluetooth Daemon on Mac OS X without restarting
View restart_bluetooth.sh
#!/bin/bash
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
@chrisdc
chrisdc / navigation.js
Last active Nov 2, 2018
Object Orientated navigation.js
View navigation.js
( function() {
function Menu( containerId, options ) {
var container,
menu,
button;
function init() {
container = document.getElementById( containerId );
if ( ! container ) {
View siteground-composer.md

How to get Composer running on SiteGround shared

  1. Download getcomposer.org/composer.phar to your account's home directory — /home/username.
  2. Edit .bashrc file in same directory by adding alias composer='/usr/local/php56/bin/php-cli ~/composer.phar' line. Update php56 part to current relevant version, if necessary.
  3. Restart SSH session or run source ~/.bashrc to reload config.
  4. Use composer command!
@GaryJones
GaryJones / .csscomb.json
Last active Nov 2, 2018
[Replaced] CSSComb file for WP core.
View .csscomb.json
See https://github.com/cedaro/grunt-wp-css/blob/develop/tasks/config/default.json
@cfoellmann
cfoellmann / tribe-events-activation-connector-oop.php
Last active Aug 29, 2015
Auto-(De-)Activate 'The Events Calendar' with 'The Events Calendar Pro' + hide 'The Events Calendar' from plugins.php listing
View tribe-events-activation-connector-oop.php
<?php
class EventsConnector {
var $events_calendar;
public function __construct() {
$this->events_calendar = 'the-events-calendar/the-events-calendar.php';
$events_calendar_pro = WP_PLUGIN_DIR . '/events-calendar-pro/events-calendar-pro.php';
@GaryJones
GaryJones / functions.php
Last active Jan 11, 2016
Default styles for HTML5 galleries and captions.
View functions.php
<?php
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) );
@fxbenard
fxbenard / getrmpomakemo.sh
Created Mar 5, 2014
Pull translations with Transifex client, create the mo and remove the po
View getrmpomakemo.sh
#! /bin/sh
# Pull all files from Transifex;
# Minimum percentage change to whatever you want
tx pull -a --minimum-perc=100
# Create .mo files from .po files.
# Twisted by WP-Translations.org, created by grappler.
for file in `find . -name "*.po"` ; do msgfmt -o ${file/.po/.mo} $file && rm $file ; done
@jrfnl
jrfnl / bccalc.php
Last active Oct 17, 2019
Do simple reliable math calculations without the risk of wrong results using bcmath
View bccalc.php
<?php
/**
* Do simple reliable floating point calculations without the risk of wrong results.
*
* @see http://floating-point-gui.de/
* @see the big red warning on http://php.net/language.types.float.php
*
* In the rare case that the bcmath extension would not be loaded, it will return the
* normal calculation results.
*
@mpeshev
mpeshev / theme-review-porto.md
Last active Dec 27, 2015
Theme Review Porto plan
View theme-review-porto.md
@nacin
nacin / auto-update.php
Last active Mar 11, 2019
This is how @dd32 and I test automatic background updates in WordPress 3.7. Then just do example.com/?wp_maybe_auto_update. (If you use a checkout of develop.svn.wordpress.org, you can run this on the `build` directory, then simply run `grunt copy` between updates to copy over the latest code from `src`. This is how we are able to make adjustmen…
View auto-update.php
<?php
// Add this as a mu-plugin.
if ( isset( $_GET['wp_maybe_auto_update'] ) ) {
add_filter( 'automatic_updates_is_vcs_checkout', '__return_false' );
add_action( 'template_redirect', function() {
$time = date( 'r' );
echo "Starting... $time<br />";
delete_site_option( 'auto_core_update_failed' );