Skip to content

Instantly share code, notes, and snippets.

View jeremyjaymes's full-sized avatar

Jeremy jeremyjaymes

View GitHub Profile
@certainlyakey
certainlyakey / functions.php
Last active August 29, 2015 14:05
Wordpress - import data from CSV table with custom column names (Really Simple CSV importer plugin)
<?php
// Goes in custom rscsvimporter_replace_save_post class before actual writing to db ($ph->add_meta, $ph->add_terms, $ph->update, $ph->insert). See here https://gist.github.com/hissy/1ea54a46fd07be9f4334
if ($meta['Title']) {
$meta_title = $meta['Title'];
$post['post_title'] = trim($meta_title);
}
$tax_map = array(
'Region' => 'regregion',
@wpsmith
wpsmith / gs-change-registered-cpt-init.php
Last active January 20, 2017 16:08
PHP: Register Custom Post Type
<?php
add_action( 'init', 'gs_books_label_rename', 999 );
/**
* Modify registered post type menu label
*
*/
function gs_books_label_rename() {
global $wp_post_types;
$wp_post_types['gs_books']->labels->menu_name = __( 'Books', 'gs_books' );
@hissy
hissy / importer-class-filter-example.php
Last active July 2, 2020 10:47
[Really Simple CSV Importer] add-on: Update row based on a custom field ID/key match
<?php
/*
Plugin Name: Update row based on a custom field ID/key match
Plugin URI: https://wordpress.org/support/topic/update-row-based-on-a-custom-field-idkey-match
*/
add_filter('really_simple_csv_importer_class', function() {
return "ImporterCustomize";
});
# Ignore everything #
**
!wp-content/
wp-content/**
!wp-content/themes/
!wp-content/plugins/
wp-content/themes/**
wp-content/plugins/**
# Add two rules for each Theme or Plugin you want to include:
@pascalmaddin
pascalmaddin / parallax-image-with-text.html
Last active May 14, 2021 14:38
An Image with parallax-effect and with some text, which is fading out while scrolling
<div id="banner">
<div class="wrap-center">
<div class="banner-centered" id="banner-text">
<h2>Hello <strong>We Are Company-Name</strong>, Glad To See You. :-)</h2>
</div>
</div>
</div>
# Set composer folder for this command and update
commands:
01updateComposer:
command: export COMPOSER_HOME=/root && /usr/bin/composer.phar self-update
option_settings:
# Add environment variable to set composer home folder
- namespace: aws:elasticbeanstalk:application:environment
option_name: COMPOSER_HOME
value: /root
@ksafranski
ksafranski / SimpleStore.js
Last active July 2, 2022 15:25
Simple localStorage function with Cookie fallback for older browsers.
/**
* Simple localStorage with Cookie Fallback
* v.1.0.0
*
* USAGE:
* ----------------------------------------
* Set New / Modify:
* store('my_key', 'some_value');
*
* Retrieve:
@markhowellsmead
markhowellsmead / array_find.js
Created April 20, 2016 14:49
Polyfill JavaScript Array.prototype.find for older browsers (e.g. IE 10, IE 11)
if (!Array.prototype.find) {
Array.prototype.find = function(predicate) {
if (this == null) {
throw new TypeError('Array.prototype.find called on null or undefined');
}
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
var list = Object(this);
var length = list.length >>> 0;
@dbisso
dbisso / 10_blackfire_repo.config
Last active February 1, 2023 15:12
Set up Blackfire on AWS Elastic Beanstalk
commands:
01_add_blackfire_repo:
command: "sudo yum install -y pygpgme && wget -O - 'http://packages.blackfire.io/fedora/blackfire.repo' | sudo tee /etc/yum.repos.d/blackfire.repo"
@ecarter
ecarter / mapOrder.js
Created December 2, 2011 15:40
Order an array of objects based on another array order
/**
* Sort array of objects based on another array
*/
function mapOrder (array, order, key) {
array.sort( function (a, b) {
var A = a[key], B = b[key];