Skip to content

Instantly share code, notes, and snippets.

@Sanabria
Sanabria / filters.php
Created June 11, 2018 20:17
include ACF into Sage 9
/**
* Customize ACF path
*/
add_filter('acf/settings/path', function ( $path ) {
$path = get_stylesheet_directory() . '/../vendor/advanced-custom-fields/advanced-custom-fields-pro/';
return $path;
});
@Sanabria
Sanabria / fix-wordpress-permissions.sh
Last active April 21, 2018 18:14 — forked from Adirael/fix-wordpress-permissions.sh
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
# Source for this script: http://www.conigliaro.org/script-to-configure-proper-wordpress-permissions/
#
# To use this script, supply the full path to your wordpress directory
@Sanabria
Sanabria / ChangeLabelWooCheckout.php
Created December 20, 2017 03:46 — forked from tavomak/ChangeLabelWooCheckout.php
Cambiar Los encabezados del checkout de woocommerce
//Detalles de facturación
function wc_billing_field_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Detalles de facturación' :
$translated_text = __( 'Nuevo Encabezado', 'woocommerce' );
break;
}
return $translated_text;
}
add_filter( 'gettext', 'wc_billing_field_strings', 20, 3 );
@Sanabria
Sanabria / creative-cloud-disable.md
Created December 7, 2017 22:57 — forked from andreibosco/creative-cloud-disable.md
disable creative cloud startup on mac
@Sanabria
Sanabria / toggle-applescript-dnd. scpt
Last active September 14, 2021 00:00
Applescript: Toggle Do Not Disturb mode
(* Note 1: The 1 after menu bar may need to be changed to 2 when using multiple monitors *)
(* Note 2: For 10.11 and newer “NotificationCenter” is now spelled “Notification Center”*)
tell application "System Events"
tell application process "SystemUIServer"
try
if exists menu bar item "Notification Center, Do Not Disturb enabled" of menu bar 1 of application process "SystemUIServer" of application "System Events" then
(* It is disabled *)
display dialog "Notifications will be turned on" buttons {"Got it"} default button 1
key down option
@Sanabria
Sanabria / random-repeater.php
Created November 1, 2017 22:16 — forked from wesrice/random-repeater.php
Return a random row of data from an ACF repeater field
<?php
// Get the repeater field
$repeater = get_field( 'repeater_field_name' );
// Get a random rows. Change the second parameter in array_rand() to how many rows you want.
$random_rows = array_rand( $repeater, 2 );
// Loop through the random rows if more than one is returned
if( is_array( $random_rows ) ){
@Sanabria
Sanabria / video.html
Created August 31, 2017 22:12 — forked from fwenzel/video.html
An example video tag, first webm, then ogv, then mp4.
<video id="movie" width="640" height="360" preload="none" controls poster="http://blog.mozilla.com/webdev/files/2011/07/mozilla_wht.png">
<source src="http://videos-cdn.mozilla.net/serv/flux/playdoh/playdoh-overview.webm" type='video/webm; codecs="vp8, vorbis"' />
<source src="http://videos-cdn.mozilla.netserv/flux/playdoh/playdoh-overview.theora.ogv" type='video/ogg; codecs="theora, vorbis"' />
<source src="http://videos-cdn.mozilla.net/serv/flux/playdoh/playdoh-overview.mp4" />
<p>Download video as <a href="http://videos-cdn.mozilla.net/serv/flux/playdoh/playdoh-overview.mp4">MP4</a>, <a href="http://videos-cdn.mozilla.net/serv/flux/playdoh/playdoh-overview.webm">WebM</a>, or <a href="http://videos-cdn.mozilla.net/serv/flux/playdoh/playdoh-overview.theora.ogv">Ogg</a>.</p>
</video>
@Sanabria
Sanabria / jquery-scroll-bottom.js
Created August 12, 2016 15:19 — forked from toshimaru/jquery-scroll-bottom.js
Detect the scrolling to bottom of the page using jQuery.
$(window).on("scroll", function() {
var scrollHeight = $(document).height();
var scrollPosition = $(window).height() + $(window).scrollTop();
if ((scrollHeight - scrollPosition) / scrollHeight === 0) {
// when scroll to bottom of the page
}
});
<a href="#share" class="share">My custom sharing button</a>
<!-- Put the real addthis Share More link somewhere and hide it -->
<a class="addthis_button_compact display_none"></a>
@Sanabria
Sanabria / vertical-align.css
Created March 9, 2016 16:04 — forked from marioblas/vertical-align.css
Twitter Bootstrap - Align vertically a column
/* Align vertically a column */
.v-align {
float: none;
display: inline-block;
vertical-align: middle;
}