Skip to content

Instantly share code, notes, and snippets.

View iign's full-sized avatar

Ignacio iign

View GitHub Profile
@jb510
jb510 / snippet.php
Created February 29, 2024 05:48
Add "Manage Patterns" menu item under Pages
<?php
/**
* Adds a menu item to the admin menu for managing patterns
*/
function s9_add_manage_patterns_menu() {
// Check if the current user has the capability to edit pages
if (!current_user_can('edit_pages')) {
return;
}
@RichardBray
RichardBray / gulp-to-webpack.md
Last active November 3, 2022 18:51
Moving from Gulp to Webpack

Moving from Gulp to webpack

I've been avoiding learning Webpack for a while now as I never thought I needed to learn another build tool, Gulp does everything I'd ever need from a build tool now or in the future. However, ever since we've moved from AngularJS to Angular (or Angular 2+) as well as introducing standards such as; TypeScript instead of Javascript and a Jasmine/Karma combo for UI testing, but also Webpack as an initial build tool. I've avoided it for long enough and now, in September 2017, I thought it's time to finally move on from my old friend Gulp.

Good Old Gulpfile

If you've never heard of Gulp before, this isn't the post to learn, there are plenty of good tutorials out there a Google search away. Then again, you don't really need to know Gulp to understand what's going on so feel free to continue reading nevertheless.

[Here's wh

@noelboss
noelboss / git-deployment.md
Last active March 7, 2024 02:21
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@atomtigerzoo
atomtigerzoo / wordpress-disable-yoast-seo-on-custom-post-type.php
Created March 31, 2016 12:39
Wordpress: Disable Yoast SEO on Custom Post Type
function my_remove_wp_seo_meta_box() {
remove_meta_box('wpseo_meta', YOUR_POST_TYPE_NAME_HERE, 'normal');
}
add_action('add_meta_boxes', 'my_remove_wp_seo_meta_box', 100);
@MikeNGarrett
MikeNGarrett / wp-config.php
Last active March 13, 2024 17:43
All those damned wp-config constants you can never remember.
<?php
// PHP memory limit for this site
define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit.
// Database
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database.
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users)
// Explicitely setting url
@schalkburger
schalkburger / contact-form-7-custom-loading-image.php
Created February 17, 2015 08:23
Contact Form 7 custom loading image
<?php
// Custom loading image
add_filter('wpcf7_ajax_loader', 'my_wpcf7_ajax_loader');
function my_wpcf7_ajax_loader () {
return get_bloginfo('stylesheet_directory') . '/img/ajax-loader.gif';
}
?>
@matthewpizza
matthewpizza / install-composer.sh
Created February 13, 2014 03:55
Install Composer on Webfaction
cd $HOME
ln -s `which php54` ~/bin/php
export PATH=$HOME/bin:$PATH
curl -sS https://getcomposer.org/installer | php54
echo -e "\n# Composer\nalias composer=\"php54 \$HOME/composer.phar\"" >> $HOME/.bash_profile
source $HOME/.bash_profile
@notasausage
notasausage / get_twitter_avatar.php
Last active December 20, 2015 10:30 — forked from banksy89/gist:3334259
Return the profile image (avatar) of a Twitter user using their RSS feed (no API call necessary).
<?php
function getTwitterAvatar( $username, $size = "normal" ) {
// mini = 24px, normal = 48px, bigger = 73px
$sizes = array( "mini", "normal", "bigger" );
// Check for size, default to normal
if( in_array( $size, $sizes ) ) {
$variant = $size;
} else {
$variant = "normal";
@media only screen and (min-width: 320px) {
/* Small screen, non-retina */
}
@media
only screen and (-webkit-min-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( min--moz-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( -o-min-device-pixel-ratio: 2/1) and (min-width: 320px),
@lukemartin
lukemartin / routes.php
Created June 22, 2012 10:51
Output checkboxes with appropriate 'checked' attributes in Laravel
Route::get('edit', function() {
// fetch our post, and it's associated categories
$post = Post::with('cats')->where('id', '=', $id)->first();
// fetch all of our categories
$cats = Cat::all();
// create our empty array
$post_cats = array();