Skip to content

Instantly share code, notes, and snippets.

View lajennylove's full-sized avatar
🚀
I'm going to have to science the shit out of this.

Jenny Martinez lajennylove

🚀
I'm going to have to science the shit out of this.
View GitHub Profile
@cobyism
cobyism / gh-pages-deploy.md
Last active July 18, 2024 05:22
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@dustyf
dustyf / gist:b6e72a7a7fd05de9598e
Last active January 16, 2023 15:34
Example WordPress Simple JSON Endpoint Plugin
<?php
/**
* Plugin Name: WDS GIF API
* Plugin URI: http://webdevstudios.com
* Description: Adds a Custom Post Type to store GIFs and an API JSON Endpoint to access GIFs by a tag.
* Author: WebDevStudios
* Author URI: http://webdevstudios.com
* Version: 1.0.0
* License: GPLv2
*/
@devinsays
devinsays / example-ajax-enqueue.php
Last active July 21, 2024 08:53
Simple WordPress Ajax Example
<?php
function example_ajax_enqueue() {
// Enqueue javascript on the frontend.
wp_enqueue_script(
'example-ajax-script',
get_template_directory_uri() . '/js/simple-ajax-example.js',
array( 'jquery' )
);
@mlbd
mlbd / Create Programmatically WordPress Nav menu
Last active July 21, 2023 13:25
Programmatically create wp nav menu from external json file
/**
* Registers a wp nav menu Programmatically.
*
* @link https://codex.wordpress.org/Function_Reference/wp_get_nav_menu_object
* @link https://codex.wordpress.org/Function_Reference/wp_create_nav_menu
* @link https://developer.wordpress.org/reference/functions/wp_update_nav_menu_item/
* @link https://developer.wordpress.org/reference/functions/wp_remote_get/
* @link https://codex.wordpress.org/Function_API/wp_remote_retrieve_body
*
* @since 1.0
@cferdinandi
cferdinandi / who-is-driving-refactor.html
Created January 30, 2019 15:04
A refactor of the vanilla JS Who's Driving app.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Who should drive?</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Styles -->
<style type="text/css">
@Dorf
Dorf / faqs.blade.php
Last active February 2, 2024 17:02
[Shortcodes in Sage] Example for FAQs #sage #blade #shortcodes #partials
///////////////////////////
// /resources/views/partials/shortcodes/faqs.blade.php
<ul class="accordion span12" data-allow-all-closed="true" data-deep-link="true" data-deep-link-smudge="true" data-deep-link-smudge-delay="600" data-accordion id="deeplinked-accordion-with-smudge">
@foreach($faqs as $faq)
<li class="accordion-item" data-accordion-item>
<a href="#{{ $category }}{{ $loop->iteration }}" class="accordion-title">{!! $faq->post_title !!}</a>
<div class="accordion-content" data-tab-content id="answer{{ $loop->iteration }}">
{!! $faq->post_content !!}
</div>
</li>
@dustinleblanc
dustinleblanc / lando.yml
Created May 3, 2019 18:04
Browsersync Lando
proxy:
mannequin:
- appname-styleguide.lndo.site
node:
- appname-bs.lndo.site:3000
services:
mannequin:
type: compose
services:
image: php:7.3
import React, { Component, Fragment } from 'react';
import QRCodeScanner from 'react-native-qrcode-scanner';
import styles from './scanStyle'
import {
TouchableOpacity,
Text,
StatusBar,
Linking,
View
} from 'react-native';
@lgladdy
lgladdy / custom-acf-json-paths.php
Last active January 11, 2024 16:09
ACF 6.2 custom load and save paths for ACF JSON
<?php
add_filter( 'acf/json/load_paths', 'set_custom_json_load_paths' );
function set_custom_json_load_paths( $paths ) {
$paths[] = get_stylesheet_directory() . '/acf-json/post-types';
$paths[] = get_stylesheet_directory() . '/acf-json/field-groups';
$paths[] = get_stylesheet_directory() . '/acf-json/taxonomies';
$paths[] = get_stylesheet_directory() . '/acf-json/option-pages';
return $paths;
}
@Log1x
Log1x / PostSearch.php
Last active June 27, 2024 07:59
Post Search component example using Acorn v4 and Livewire 3
<?php
namespace App\Livewire;
use Livewire\Attributes\Url;
use Livewire\Component;
use WP_Query;
class PostSearch extends Component
{