Skip to content

Instantly share code, notes, and snippets.

View jrobinsonc's full-sized avatar
🎯
Focusing

Jose Robinson jrobinsonc

🎯
Focusing
View GitHub Profile
@jrobinsonc
jrobinsonc / regex-patterns.md
Last active September 18, 2021 14:53
Regex patterns
@jrobinsonc
jrobinsonc / vscode-psalm-task.md
Last active September 18, 2021 18:39
VSCode task problemMatcher for Psalm

Use Psalm to check your PHP files in VSCode

First, install the composer package: composer require --dev vimeo/psalm.

Then, add this code to your .vscode/tasks.json:

{
      "label": "Psalm",
 "detail": "Run Psalm",
@iskenxan
iskenxan / useAsync.js
Last active August 28, 2021 01:13
useAsync
export const useAsync = ({ asyncFunction }) => {
const [loading, setLoading] = useState(false);
const [error, setError] = useState(null);
const [result, setResult] = useState(null);
const execute = useCallback(
async (...params) => {
try {
setLoading(true);
const response = await asyncFunction(...params);
@salcode
salcode / .editorconfig
Last active October 15, 2022 21:22
WordPress .editorconfig - modified version of the WordPress coding standards
# EditorConfig helps keep your project formatting consistent.
# See https://EditorConfig.org
#
# This is a modified version of the WordPress coding standards.
#
# Author: Sal Ferrarello (@salcode)
# https://salferrarello.com/wordpress-editorconfig/
#
# You can download this file directly
# to your project from the command-line with

PHPExcel Cheat Sheet

Documentation

Snippets

Install.

composer require phpoffice/phpexcel
@jrobinsonc
jrobinsonc / README.md
Last active May 7, 2016 16:33
WP_Widget_Ex: An easy way to create widgets in WordPress.

WP_Widget_Ex

An easy way to create widgets in WordPress

Usage

First: Require the WP_Widget_Ex class.

require_once get_template_directory() . '/inc/wp_widget_ex.php';
@jrobinsonc
jrobinsonc / wp-create-thumb.php
Last active April 7, 2016 01:52
Wordpress helper: create_thumb.
<?php
/**
* create_thumb
*
* @author JoseRobinson.com
* @link https://gist.github.com/jrobinsonc/b40c99a4d688f8a2d554
* @param string $file_src_path
* @param int $width
* @param int $height
@bjornjohansen
bjornjohansen / run-wp-cron.sh
Last active September 17, 2023 21:12
Run all due cron events for WordPress with WP-CLI. Works with both single sites and multisite networks.
#!/bin/bash
# Copyright © 2015 Bjørn Johansen
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
WP_PATH="/path/to/wp"
# Check if WP-CLI is available
if ! hash wp 2>/dev/null; then
@lambdahands
lambdahands / _readme.md
Created September 28, 2015 17:09
FlowType and CSS Modules

Huh?

So basically FlowType doesn't know about CSS Modules, a really handy way of dealing with the plagues of CSS in codebases (global variables and dependency wackiness mainly).

What WebPack allows us to do is "require" CSS files and use their class names:

import styles from "my_styles.css";
import React from "react";
@jrobinsonc
jrobinsonc / wp-widget-php.php
Created August 31, 2015 23:24
Wordpress filter: Execute PHP from widgets.
<?php
/**
* Execute PHP from widgets.
*/
add_filter('widget_text', function ($html){
if(strpos($html, "<"."?php") !== false)
{
ob_start();