Skip to content

Instantly share code, notes, and snippets.

View mandiwise's full-sized avatar

Mandi Wise mandiwise

  • Edmonton, Canada
View GitHub Profile
@mandiwise
mandiwise / sql.txt
Last active May 29, 2016 19:47
Renaming WP Database Table Preifx
RENAME table `wp_commentmeta` TO `NEWPREFIX_commentmeta`;
RENAME table `wp_comments` TO `NEWPREFIX_comments`;
RENAME table `wp_links` TO `NEWPREFIX_links`;
RENAME table `wp_options` TO `NEWPREFIX_options`;
RENAME table `wp_postmeta` TO `NEWPREFIX_postmeta`;
RENAME table `wp_posts` TO `NEWPREFIX_posts`;
RENAME table `wp_terms` TO `NEWPREFIX_terms`;
RENAME table `wp_termmeta` TO `NEWPREFIX_termmeta`;
RENAME table `wp_term_relationships` TO `NEWPREFIX_term_relationships`;
RENAME table `wp_term_taxonomy` TO `NEWPREFIX_term_taxonomy`;
@mandiwise
mandiwise / App.css
Created September 7, 2016 17:53
CSS for react-todo app
/* To-Do List */
/*-----------------------------------------*/
#root {
display: flex;
justify-content: center;
height: 100vh;
}
.todo-list {
@mandiwise
mandiwise / functions.php
Last active January 27, 2017 21:26
Save an option to the database containing unexpected output during plugin activation
<?php
/**
* Usage: "echo get_option('plugin_error');" or look for the option the DB after activation
*
* @link http://thehungrycoder.com/wordpress/how-i-have-solved-the-the-plugin-generated-xxxx-characters-of-unexpected-output-during-activation-problem.html
*/
function save_error(){
update_option( 'plugin_error', ob_get_contents()) ;
@mandiwise
mandiwise / functions.php
Last active January 27, 2017 21:27
Prevent a given form submitter from entering the same value in a form field twice (on multiple submits)
<?php
function no_duplicate_votes($validation_result){
global $wpdb;
$nominee_field = 1;
$email_field = 2;
$form = $validation_result['form'];
foreach( $form["fields"] as &$field ) {
if ( $field['id'] == $email_field ) {
$email_value = rgpost("input_{$field['id']}");
@mandiwise
mandiwise / styles.css
Created January 31, 2017 19:11
CSS for meteor-react-todo app AccountsUiWrapper component
/* Account Login */
/*-----------------------------------------*/
.app-wrapper {
align-items: center;
display: flex;
justify-content: center;
height: 100vh;
}
@mandiwise
mandiwise / Dynamically Populate Gravity Forms Text Field
Last active May 20, 2017 00:33
Using gform_field_value_{param}
function my_city_population_function( $value ){
return 'Vancouver';
}
add_filter( 'gform_field_value_my_city', 'my_city_population_function' );
@mandiwise
mandiwise / dploy.yaml
Last active October 12, 2017 02:53
Community Project DPLOY config file
staging:
scheme: sftp
host: PROJECT-NAME.cp.academy.red
port: 22
user: YOUR PROJECT NAME
pass: YOUR SFTP PASSWORD
check: true
include:
"themes/[YOUR-THEME-NAME]/build/**": "themes/[YOUR-THEME-NAME]/build/"
exclude: [ "README.md", ".gitignore", "themes/[YOUR-THEME-NAME]/.eslintrc", "themes/[YOUR-THEME-NAME]/gulpfile.js", "themes/[YOUR-THEME-NAME]/package.json", "themes/[YOUR-THEME-NAME]/package-lock.json", "themes/[YOUR-THEME-NAME]/js/**", "themes/[YOUR-THEME-NAME]/sass/**" ]
@mandiwise
mandiwise / .gitignore
Last active December 4, 2017 19:25
Communit Project .gitignore
# COMMUNITY PROJECT GITIGNORE #
# Ignore OS files #
# =============== #
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
@mandiwise
mandiwise / dataFormatHelpers.js
Last active May 22, 2018 01:30
Function to help format data fetched from the R10 Graphcool API for a React Native SectionList.
// Helper to format GraphQL data into section list data
export const formatSessionData = sessions => {
return sessions
.reduce((acc, curr) => {
const timeExists = acc.find(section => section.title === curr.startTime);
timeExists
? timeExists.data.push(curr)
: acc.push({ title: curr.startTime, data: [curr] });
return acc;
}, [])
@mandiwise
mandiwise / data.js
Last active April 17, 2019 20:14
Some sample movie data
const data = {
people: [
{
id: 1,
name: "Mark Hamill",
birthday: "September 25, 1951",
placeOfBirth: "Oakland, California, USA",
bio:
"Mark Hamill is best known for his portrayal of Luke Skywalker in the original Star Wars trilogy.",
filmography: [1]