Skip to content

Instantly share code, notes, and snippets.

View RafaelFunchal's full-sized avatar

Rafael Funchal RafaelFunchal

View GitHub Profile
@jessepearson
jessepearson / storefront-two-columns.css
Last active June 22, 2020 01:34
CSS to add to make Storefront display two columns in mobile views.
ul.products li.product {
width: 46.411765%;
float: left;
margin-right: 5.8823529412%;
}
ul.products li.product:nth-of-type( 2n ) {
margin-right: 0;
}
@alokstha1
alokstha1 / install-wordpress-standard.txt
Created November 18, 2015 12:05
Install PHPCS with WordPress Coding Standard with Sublime Text 3
#optional part to install wordpress coding standards
git clone https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git wpcs
# tell phpcs about the wordpress coding standards
cd ~/bin/phpcs
scripts/phpcs --config-set installed_paths ../wpcs
# we probably want to ignore the space indenting on the files
vim ~/bin/ruleset.xml
@fdaciuk
fdaciuk / 01 - Sublime Configurations.md
Last active March 11, 2021 00:56
Sublime Configurations
function mailpoet_enable_wpmail(){
if(class_exists('WYSIJA')){
$model_config = WYSIJA::get('config','model');
$model_config->save(array('allow_wpmail' => true));
}
}
add_action('init', 'mailpoet_enable_wpmail');
@bordoni
bordoni / mailpoet-insert_new_user.php
Last active March 18, 2018 23:27
Insert a new user to MailPoet and handle custom fields
<?php
// The ID of the lists you want to add a user to
$list_ids = array( 1 );
// User Data without the custom fields
$data_subscriber = array(
'user' => array(
'email' => '[email protected]',
'firstname' => 'John',
'lastname' => 'Doe',
# Activate the wordpress importer
wp plugin activate wordpress-importer --url=http://localhost/example.com/
# Iterate over all of the import files in a given folder.
for f in myfolder/*.xml; do wp import $f --authors=skip --skip=attachment --url=localhost/example.com/; done
@benheu
benheu / undo_unsubscribe_shortcode.php
Last active August 29, 2015 13:57
Generate a undo unsubscribe link to display in my theme
<?php
/**
* function to return an undo unsbscribe string for MailPoet newsletters
* you could place it in the functions.php of your theme
* @return string
*/
function mpoet_get_undo_unsubscribe(){
if(class_exists('WYSIJA') && !empty($_REQUEST['wysija-key'])){
$undo_paramsurl = array(
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active September 15, 2024 20:33
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@bordoni
bordoni / wcsp2013-bordoni-ex-00.php
Last active December 29, 2015 03:49
Exemplos do WordCamp SP 2013 Slides em: http://bit.ly/wcsp2013_bordoni
<?php
// Exemplo 1
// Filtra a edição de posts da categoria 6 permitida apenas para os usuários 5 e 9
add_filter( 'user_has_cap', function( $allcaps, $caps, $args, $user ){
if ( in_array($args[0], array( 'edit_post' ) ) )
return $allcaps;
// Para `edit_post` será passado um argumento com o ID do post que desejamos verificar
if ( !isset( $args[2] ) || $args[2] == 0 || !is_numeric($args[2]) )
return $allcaps;
@vmassuchetto
vmassuchetto / deploy.php
Last active December 28, 2015 00:19
PHP script to automate deploy using Git
<?php
/**
* This scripts is intended to be triggered by Git hooks. For deployment you'll
* probably want to use `post-update`:
* http://schacon.github.io/git/githooks.html#post-update
*
* First, set the `PASS` constant to limit access to this script and use it as
* a `pass` GET variable.
*