Skip to content

Instantly share code, notes, and snippets.

@shashankmehta
shashankmehta / setup.md
Last active January 7, 2024 11:57
Setup PHP and Composer on OSX via Brew

First install Brew on your MAC

  • Setup Brew: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • brew update
  • brew tap homebrew/dupes
  • brew tap homebrew/php
  • Install PHP 7.0.+ brew install php70
  • Install mcrypt: brew install mcrypt php70-mcrypt
  • Finally, install composer: brew install composer
@FrancesCoronel
FrancesCoronel / sampleREADME.md
Last active August 28, 2024 03:20
A sample README for all your GitHub projects.

Repository Title Goes Here

Frances Coronel

INSERT GRAPHIC HERE (include hyperlink in image)

Subtitle or Short Description Goes Here

ideally one sentence >

@jessehintze
jessehintze / bxthumb slider
Created July 31, 2015 17:49
bxslider with linked thumbnail slider
var sliders = {
realSlider : '',
realThumbSlider : '',
init : function(){
if($(window).width() <= 767){
sliders.startSliders();
}
sliders.windowResize();
},
@dovy
dovy / compiler.php
Last active February 2, 2018 22:58
<?php
Redux::setSection( $opt_name, array(
'title' => __( 'Text Area', 'redux-framework-demo' ),
'desc' => __( 'For full documentation on this field, visit: ', 'redux-framework-demo' ) . '<a href="http://docs.reduxframework.com/core/fields/textarea/" target="_blank">http://docs.reduxframework.com/core/fields/textarea/</a>',
'id' => 'opt-textarea-subsection',
'subsection' => true,
'fields' => array(
array(
'id' => 'background-parallax',
@tomazzaman
tomazzaman / hhvm.conf
Last active May 13, 2021 19:44
Monit configurations for commonly used services
check process hhvm with pidfile /var/run/hhvm/pid
group hhvm
start program = "/usr/sbin/service hhvm start" with timeout 60 seconds
stop program = "/usr/sbin/service hhvm stop"
if failed unixsocket /var/run/hhvm/hhvm.sock then restart
if mem > 400.0 MB for 1 cycles then restart
if 5 restarts with 5 cycles then timeout
@DevinWalker
DevinWalker / layerslider-conditional.php
Created November 21, 2013 19:12
Load LayerSlider scripts/styles only when a shortcode is present in the content (can be modified to custom meta, etc).
<?php
/**
* Load LayerSlider Scripts only when shortcode is present
*
* Deregister Scripts from LayerSlider if no shortcode in content
* Using do_shortcode function? See: http://wordpress.stackexchange.com/questions/20854/conditionally-loading-javascript-css-for-shortcodes/75915#75915
*/
function check_for_layerslider_shortcode() {
global $post;
@dovy
dovy / frameworkinit.php
Last active December 26, 2015 21:49
Use this to include ReduxFramework in your theme or plugin. It will ensure the ReduxFramework Plugin loads first. If not present your local copy will be used. This way there's no cross-over and if the user has the plugin they always get the newest version.
<?php
/*
This can be included in your functions.php file. It checks to make sure the plugin is not activated. Please note,
if you have the plugin in any other directory than redux-framework (ie, you installed via the Github Repo), this will not function.
*/
include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // Comment this line if within template files, IE required in files like functions.php
if ( !is_plugin_active('ReduxFramework/redux-framework.php') && !is_plugin_active('redux-framework/redux-framework.php') && !is_plugin_active('ReduxFramework-master/redux-framework.php') ) {
if ( !$active && !class_exists( 'Redux_Framework' ) && file_exists( dirname( __FILE__ ) . '/ReduxFramework/ReduxCore/framework.php' ) ) {
require_once( dirname( __FILE__ ) . '/ReduxFramework/ReduxCore/framework.php' );
}
@boogah
boogah / wp_mysql_optimizations.sql
Last active April 20, 2017 20:32
Common database optimizations for WordPress sites.
/* Delete revisions */
DELETE FROM wp_posts WHERE post_type = "revision";
/* Only use this if you no longer care about any of your current revisions! */
/* Delete trashed posts */
DELETE FROM wp_posts WHERE post_type = "trash";
/* Delete Jetpack Feedback Spam */
SELECT * FROM wp_posts WHERE wp_posts.post_type = "feedback" AND wp_posts.post_status= "spam";
@wycks
wycks / image_optimize-wordpress.php
Last active December 16, 2020 01:48
Remove WordPress full size images from being inserted into a post + option to and add max size to to prevent users from inserting massive images.
<?php
/**
*
* This removes the ability to add the FULL image size into a post, it does not alter or delete the image
* Add whataever extra image sizes to the insert dropdown in WordPress you create via add_image_size
*
* For now we have to do it this way to make the labels translatable, see trac ref below.
*
* If your theme has $content_width GLOBAL make sure and remove it
@wpscholar
wpscholar / functions.php
Last active October 20, 2024 14:01
Enqueueing IE conditional stylesheets in WordPress the right way
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' );
/**
* Example callback function that demonstrates how to properly enqueue conditional stylesheets in WordPress for IE.
* IE10 and up does not support conditional comments in standards mode.
*
* @uses wp_style_add_data() WordPress function to add the conditional data.
* @link https://developer.wordpress.org/reference/functions/wp_style_add_data/