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 September 6, 2024 09:23
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 August 12, 2024 11:44
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;
@DanielSWolf
DanielSWolf / Program.cs
Last active September 5, 2024 21:33
Console progress bar. Code is under the MIT License: http://opensource.org/licenses/MIT
using System;
using System.Threading;
static class Program {
static void Main() {
Console.Write("Performing some task... ");
using (var progress = new ProgressBar()) {
for (int i = 0; i <= 100; i++) {
progress.Report((double) i / 100);
@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 September 20, 2024 01:36
`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)];