Skip to content

Instantly share code, notes, and snippets.

View jeremyjaymes's full-sized avatar

Jeremy jeremyjaymes

View GitHub Profile
@redoPop
redoPop / .gitignore
Created June 18, 2010 22:08
Template .gitignore file for WordPress projects
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@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];
@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:
@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>
@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' );
@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',
@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";
});
@cletusw
cletusw / .eslintrc
Last active February 29, 2024 20:24
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@amochohan
amochohan / 01_Laravel 5 Simple ACL manager_Readme.md
Last active April 22, 2024 17:19
Laravel 5 Simple ACL - Protect routes by an account / role type

#Laravel 5 Simple ACL manager

Protect your routes with user roles. Simply add a 'role_id' to the User model, install the roles table and seed if you need some example roles to get going.

If the user has a 'Root' role, then they can perform any actions.

Installation

Simply copy the files across into the appropriate directories, and register the middleware in App\Http\Kernel.php