Skip to content

Instantly share code, notes, and snippets.

View tazeverywhere's full-sized avatar

Sylvain tazeverywhere

View GitHub Profile
@tazeverywhere
tazeverywhere / pull.php
Created May 3, 2018 16:31
Pull.php: Version control your MODX site using git. Pulls changes from git and processes database changes in changesets.
<?php
/**
* Pull.php:
* Version control your MODX site using git.
* Pulls changes from git and processes database changes in changesets.
*
* Authors:
* Jeroen Kenters / www.kenters.com
* Bert Oost / www.oostdesign.com
*
@tazeverywhere
tazeverywhere / sync-prod.sh
Created March 10, 2018 17:02 — forked from retlehs/sync-prod.sh
WP-CLI aliases sync example
read -r -p "Would you really like to reset your development database and pull the latest from production? [y/N] " response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
wp @development db reset --yes &&
wp @production db export - > sql-dump-production.sql &&
wp @development db import sql-dump-production.sql &&
wp @development search-replace https://example.com https://example.dev
fi
/*------------------------------------------------------------------------------------------
* WORPDRESS MULTIPLE ENVIRONMENT
*-----------------------------------------------------------------------------------------*/
//GET HOSTNAME INFO
$hostname = $_SERVER['SERVER_NAME'];
//VERIFY WHICH ENVIRONMENT THE APP IS RUNNING
switch ($hostname) {
case 'development.dev':
@tazeverywhere
tazeverywhere / Gemfile
Created September 19, 2017 14:13 — forked from hal0gen/Gemfile
Wordmove + Bedrock + Capistrano: using Wordmove for DB and assets, Capistrano for all the rest
source 'https://rubygems.org'
gem 'capistrano', '~> 3.4.0'
gem 'capistrano-composer'
gem 'wordmove'
# deploy.rb from https://github.com/roots/bedrock-capistrano modified by Björn Folbert, https://gist.github.com/folbert/
# Folbert-comment: from Capistrano doc:
# Here we'd set the name of the application, must be in a format that's safe for
# filenames on your target operating system.
set :application, 'APPLICATIONNAME'
# Folbert-comment: use the SSH url for the repo from GitHub
set :repo_url, 'git@github.com:USER/REPO.git'
@tazeverywhere
tazeverywhere / gist:2d56c625e4b2d42fef7e9a71bad5cac6
Created May 16, 2017 08:58 — forked from depoulo/gist:5832073
CSS-only multi-line ellipsis with generated content. License: http://www.wtfpl.net/txt/copying/
@import "compass/css3/images";
// CSS-only multi-line ellipsis with generated content
// yields `position:relative`, so remember to declare an eventual `position:absolute/fixed` *after* including this mixin
@mixin limitLines(
$maxLinesPortrait, // Mandatory: The number of lines after which the clipping should take action.
$maxLinesLandscape: $maxLinesPortrait, // You may provide a different line limit for landscape orientation.
// Note that 'portrait' is our default orientation. However, if you omit $maxLinesLandscape,
// the value of $maxLinesPortrait is used for whatever orientation (that is, without a media query).

Example: You have a branch refactor that is quite different from master. You can't merge all of the commits, or even every hunk in any single commit or master will break, but you have made a lot of improvements there that you would like to bring over to master.

Note: This will not preserve the original change authors. Only use if necessary, or if you don't mind losing that information, or if you are only merging your own work.

On master:

> git co -b temp
@tazeverywhere
tazeverywhere / scss-specificity.scss
Created April 1, 2016 16:40
Css specificity with sass
&__link {
// Hacks for dealing with specificity
// http://csswizardry.com/2014/07/hacks-for-dealing-with-specificity/
&#{&} {
color: black;
}
}
<?php
/*
* Fix Advanced Custom Field dynamic key filter for repeater entries
* @link http://www.advancedcustomfields.com/resources/how-to/how-to-query-posts-filtered-by-custom-field-values/
*/
add_filter( 'posts_where', 'acf_repeater_dynamic_where', 10, 2 );
function acf_repeater_dynamic_where( $where, &$wp_query ){
if( !empty( $wp_query->meta_query->queries ) ){
$keys = wp_list_pluck( $wp_query->meta_query->queries, "key" );
<!-- WEKMENU -->
<?php
// Global vars
$pageResto = 40;
$weekMenu = get_field('weekmenu', $pageResto);
?>
<?php if ($weekMenu) { ?>
<div class="sidebar-block week-menu">
<span class="icon-title glyphicon glyphicon-cutlery" aria-hidden="true"></span>
<div class="menu-content">