Skip to content

Instantly share code, notes, and snippets.

View jeremysimmons's full-sized avatar

Jeremy Simmons jeremysimmons

View GitHub Profile
@jherax
jherax / configure.md
Last active May 2, 2024 21:54
VS Code: Debugging with Jest

VS Code: Debugging Jest

Sometimes, debugging with console.log is not enough to find out what is happening in the code, as console.log prints only plain objects but neither functions nor objects with circular references. Besides, it's possible you may need to know the context and flow of the code.

Read more about debugging with VS Code in VS Code: Debugging.

@lukecav
lukecav / Commands
Last active January 9, 2024 06:48
Speed up wp db export using WP-CLI
# Export site database using wp db export
wp db export /wp-content/wordpress-dump.sql --all-tablespaces --single-transaction --quick --lock-tables=false
# Gzip compress the recent database export
gzip wordpress-dump.sql
# Export sites database using wp db export and gzip compress
wp db export --all-tablespaces --single-transaction --quick --lock-tables=false - | gzip -9 - > wordpress-dump.sql.gz
@jacargentina
jacargentina / PHPSerializer.cs
Created March 7, 2018 17:16
C# deserialize php
/// <summary>
/// Serializer Class.
/// </summary>
public class PHPSerializer
{
//types:
// O = Object
// N = null
// s = string
// i = int
@Neunerlei
Neunerlei / ArrayPathHelper.php
Created February 1, 2018 21:07
A rather simple helper to access php array's using paths. Supporting wildcards and branching.
<?php
/**
* User: Martin Neundorfer and Arnfired Weber
* Date: 01.02.2018
* Time: 10:54
* Vendor: LABOR.digital
*/
namespace Labor\X\Utilities\Arrays\Helpers;
@1wdtv
1wdtv / use-plugin-to-override-woocommerce.php
Created June 22, 2016 19:24
Use plugin to override woocommerce template files (instead of child theme)
// modify default wc template override so it uses our plugin templates instead
// https://www.skyverge.com/blog/override-woocommerce-template-file-within-a-plugin/
function lab_flavor_plugin_path() {
// gets the absolute path to this plugin directory
return untrailingslashit( plugin_dir_path( __FILE__ ) );
}
add_filter( 'woocommerce_locate_template', 'lab_flavor_woocommerce_locate_template', 10, 3 );
function lab_flavor_woocommerce_locate_template( $template, $template_name, $template_path ) {
global $woocommerce;
@sayedihashimi
sayedihashimi / transform-xml.ps1
Last active January 17, 2024 20:02
Script which can be used to transform an XML file using XDT. All you need to do is download the script and call it. The script will download the files it needs to run.
#!/usr/bin/env powershell
<#
.SYNOPSIS
You can use this script to easly transform any XML file using XDT.
To use this script you can just save it locally and execute it. The script
will download its dependencies automatically.
Created by sayediHashimi
Modified by obscurerichard
Thanks Stack Overflow: https://stackoverflow.com/questions/8989737/web-config-transforms-outside-of-microsoft-msbuild
@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active May 3, 2024 12:32
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@alexisnomine
alexisnomine / breadcrumbs.css
Last active October 12, 2020 14:55
Breadcrumb when navigating folders in a Sharepoint 2010 Document Library WebPart. (Pure JS, No jQuery, IE8+) Can be inserted via a "HTML Form Web Part" or referenced in a custom masterpage.
.ms-WPHeader .breadcrumbs{
display:block;
font-style:italic;
}
.ms-WPHeader .breadcrumbs,.ms-WPHeader .breadcrumbs a{
font-size: 0.8em;
color:#D1D1D1;
}
@speier
speier / EmbeddedResourceTypes.cs
Created July 19, 2013 09:16
ASP.NET MVC embedded views and virtual path provider
using System.Collections.Generic;
using System.IO;
namespace Portal.Common.EmbeddedResources
{
public static class EmbeddedResourceTypes
{
public static string GetContentType(string path)
{
return MimeTypes[Path.GetExtension(path)];
@petenelson
petenelson / admin_head_post_edit_check.php
Created November 1, 2012 17:03
WordPress admin action hooks for listing/adding/editing posts or pages
/* actions fired when listing/adding/editing posts or pages */
/* admin_head-(hookname) */
add_action( 'admin_head-post.php', 'admin_head_post_editing' );
add_action( 'admin_head-post-new.php', 'admin_head_post_new' );
add_action( 'admin_head-edit.php', 'admin_head_post_listing' );
function admin_head_post_editing() {
echo 'you are editing a post';
}