Skip to content

Instantly share code, notes, and snippets.

View jasperf's full-sized avatar
🏠
Working from home

Jasper Frumau jasperf

🏠
Working from home
View GitHub Profile
@jasperf
jasperf / find-base64-occurences
Created September 21, 2022 11:38 — forked from anotheremily/find-base64-occurences
hackers seem to like base64 encoding their php commands
#!/bin/bash
find . -name "*.php" -exec grep "base64" '{}' \; -print &> b64-detections.txt
find . -name "*.php" -exec grep "eval" '{}' \; -print &> eval-detections.txt
@jasperf
jasperf / ci.yml
Last active April 22, 2022 10:39
CI Github Action for Laravel with Vue and PHP Deployer incl. npm run prod and git commit
name: CD
# this workflow will deploy your application to production when
# a new release has been created in GitHub
on:
release:
types: [released]
push:
tags:
- 'v*'
@jasperf
jasperf / block.php
Created April 15, 2022 06:16
old recent block block
<?php
/**
* Most Recent Content block
*
**/
/**
* First, let's compile an array of the things we want to display. The
* posts are the easy part, so let's do those first.
*/
@jasperf
jasperf / block.php
Last active April 14, 2022 09:57
blocks/highlights/block.php or new blocks/recent/block.php
<?php
/**
* Most Recent Content block
*
**/
/**
* First, let's compile an array of the things we want to display. The
* posts are the easy part, so let's do those first.
*/
@jasperf
jasperf / deploy.sh
Created February 27, 2022 06:33 — forked from cagartner/deploy.sh
Laravel Push deploy Github actions example
#!/bin/sh
set -e
vendor/bin/phpunit
(git push) || true
git checkout production
git merge master
@jasperf
jasperf / memberpress-use-coupon-once-per-user.php
Created February 2, 2022 09:34 — forked from cartpauj/memberpress-use-coupon-once-per-user.php
User cannot use coupon more than once with MemberPress
<?php
function custom_validate_coupon($errors) {
global $wpdb;
//If user is not logged in, then they've never used a coupon before
if(!MeprUtils::is_user_logged_in()) { return $errors; }
$coupon_code = (isset($_POST['mepr_coupon_code']) && !empty($_POST['mepr_coupon_code']))?stripslashes($_POST['mepr_coupon_code']):'';
if(($coupon = MeprCoupon::get_one_from_code($coupon_code)) && isset($coupon->ID) && $coupon->ID) {
@jasperf
jasperf / font-awesome-overwrite.scss
Created December 31, 2021 08:28 — forked from alvesoaj/font-awesome-overwrite.scss
Font Awesome overwrite to set the correct font path in Ruby On Rails and work in Production
/*!
* Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome
* License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
*/
@import "font-awesome/scss/variables";
/* FONT PATH VARIABLE
* -------------------------- */
$fa-font-path: "font-awesome/fonts/";
/* -------------------------- */
@jasperf
jasperf / jquery-plugin-template.js
Created November 19, 2021 08:47 — forked from publicJorn/jquery-plugin-template.js
jQuery plugin template
/**
* jQuery plugin template by https://github.com/publicJorn
* Features:
* - dynamic plugin name (only supply once) so it's easy to change later
* - plugin factory to make it work in the browser, or with AMD / COMMONJS modules
* - Plugin instance is saved on the selector element
* - Default options are saved to the instance in case you need to figure out a difference between passed options
*/
(function(global, factory) {
'use strict';
@jasperf
jasperf / wp-search-replace-and-add-new-user.sh
Last active November 4, 2021 02:59
search replace site name in WordPress Database using WP CLI and add new admin for local testing
### dry run
wp search-replace 'live-site.com' 'test-site.test' --skip-columns=guid --dry-run
### for real
wp search-replace 'live-site.com' 'test-site.com' --skip-columns=guid
### add admin user
wp user create jasper [email protected] --role=--role=administrator
@jasperf
jasperf / event-cat-taxonomy.php
Created November 1, 2021 03:11
CPT Events Category Taxonomy made with CPT UI
function cptui_register_my_taxes_event_category() {
/**
* Taxonomy: Event Categories.
*/
$labels = [
"name" => __( "Event Categories", "custom-post-type-ui" ),
"singular_name" => __( "Event Category", "custom-post-type-ui" ),
];