Skip to content

Instantly share code, notes, and snippets.

View iHwy's full-sized avatar

Mark Brown iHwy

View GitHub Profile
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
export default defineConfig({
base: "./",
filenameHashing: false,
plugins: [vue()],
build: {
rollupOptions: {
@iHwy
iHwy / git.migrate
Created May 1, 2022 22:12 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@iHwy
iHwy / card-weather-forecast.blade.php
Created November 28, 2021 00:53 — forked from mithicher/card-weather-forecast.blade.php
Weather Forecast Card Blade Component
// Usage
// <x-card-weather-forecast location="Guwahati" api-key="your-weatherapi.com-api-key" />
@props([
"location" => "Guwahati",
"apiKey" => "",
"poll" => 10000
])
<div class="bg-white shadow rounded-lg p-5 dark:bg-gray-800 max-w-full"
@iHwy
iHwy / AutoGeneratesPosition.php
Created February 20, 2021 04:17 — forked from tanthammar/AutoGeneratesPosition.php
Auto generate spatial point when creating or updating a Model
<?php
namespace App\Traits;
use App\Helpers\GeoHelper;
use Grimzy\LaravelMysqlSpatial\Types\Point;
trait AutoGeneratesPosition
{
@iHwy
iHwy / wp-config.php
Created September 12, 2019 19:41
Set WordPress site URL in the config file instead of the database
<?php
// WordPress stores the site URL in the database by default (which I have never
// understood), and it's a pain to have to type out the UPDATE SQL or search in
// phpMyAdmin to change it. This is a simple way to put the URL into
// wp-config.php instead.
// Note that you will still need to update any URLs that appear in the content,
// especially when you copy a database from a development site to production:
// https://gist.github.com/davejamesmiller/a8733a3fbb17e0ff0fb5
/**
* Returns a user meta value
* Usage [um_user user_id="" meta_key="" ] // leave user_id empty if you want to retrive the current user's meta value.
* meta_key is the field name that you've set in the UM form builder
* You can modify the return meta_value with filter hook 'um_user_shortcode_filter__{$meta_key}'
*/
function um_user_shortcode( $atts ) {
$atts = extract( shortcode_atts( array(
'user_id' => get_current_user_id(),
'meta_key' => '',
@iHwy
iHwy / functions.php
Created March 9, 2019 16:36 — forked from cre8tivediva/functions.php
Rename the Genesis Portfolio Slug
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
add_action( 'init', 'rename_portfolio_custom_post_type_slug', 5 );
/**
* Rename slug in Genesis Portfolio Plugin.
*
* @author Anita Carter
* @link https://cre8tivediva.com/rename-genesis-portfolio-slug
*/
@iHwy
iHwy / gravity-forms-material-design.css
Created March 5, 2019 16:46
Styling Gravity Forms with Material Design Look
/*** MAIN WRAPPER ***/
.gform_wrapper {
background: #6000AA;
padding: 5%;
}
/*** REMOVE LABEL FOR PLACEHOLDER ONLY ***/
.gform_wrapper .top_label .gfield_label,
.gform_wrapper .field_sublabel_below .ginput_complex.ginput_container label {
display: none;
@iHwy
iHwy / index.php
Created December 24, 2017 15:02 — forked from ziadoz/index.php
Simple PHP / jQuery CSRF Protection
<?php
// See: http://blog.ircmaxell.com/2013/02/preventing-csrf-attacks.html
// Start a session (which should use cookies over HTTP only).
session_start();
// Create a new CSRF token.
if (! isset($_SESSION['csrf_token'])) {
$_SESSION['csrf_token'] = base64_encode(openssl_random_pseudo_bytes(32));
}
@iHwy
iHwy / disable-plugins-when-doing-local-dev.php
Created August 26, 2017 02:35 — forked from johnpbloch/disable-plugins-when-doing-local-dev.php
Disables specified WordPress plugins when doing local development
<?php
/*
Plugin Name: Disable plugins when doing local dev
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify
Version: 0.1
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/