Skip to content

Instantly share code, notes, and snippets.

View jcicero518's full-sized avatar

Jeff Cicero jcicero518

View GitHub Profile
@jcicero518
jcicero518 / custom-nav-walker-usage.php
Created November 11, 2020 17:12 — forked from kosinix/custom-nav-walker-usage.php
WordPress: Using a custom nav walker to create navigation menus in plain <a> tags. That is the <ul> and <li> tags are not present. Very useful if you want to create simple links that can be centered with a simple text-align:center on the containing element.
<?php
// In your template files like footer.php
// The items_wrap value ('%3$s') removes the wrapping <ul>, while the custom walker (Nav_Footer_Walker) removes the <li>'s.
wp_nav_menu(array('items_wrap'=> '%3$s', 'walker' => new Nav_Footer_Walker(), 'container'=>false, 'menu_class' => '', 'theme_location'=>'footer', 'fallback_cb'=>false ));
?>
@jcicero518
jcicero518 / _bootstrap_bulma_helpers.scss
Created September 8, 2020 17:21 — forked from wrabit/_bootstrap_bulma_helpers.scss
Bootstrap style responsive helper utilities for Bulma
/*
Start Bootstrap style responsive spacer helper
Utilities for spacing, text and float
*/
$spacer: 1rem !default;
$spacers: () !default;
$spacers: map-merge((
@jcicero518
jcicero518 / settings.local.php
Created August 31, 2020 20:17 — forked from keopx/settings.local.php
Drupal 8 Redis settings.local.php
<?php
/**
* Set redis configuration.
*/
/** @see: https://docs.platform.sh/frameworks/drupal8/redis.html */
if (extension_loaded('redis')) {
// Set Redis as the default backend for any cache bin not otherwise specified.
// $settings['cache']['default'] = 'cache.backend.redis';
@jcicero518
jcicero518 / BetterRestSerializer.php
Created July 29, 2020 01:39 — forked from daggerhart/BetterRestSerializer.php
Drupal 8 views style plugin for a better rest serializer.
<?php
namespace Drupal\my_module\Plugin\views\style;
use Drupal\rest\Plugin\views\style\Serializer;
/**
* The style plugin for serialized output formats.
*
* @ingroup views_style_plugins
@jcicero518
jcicero518 / referer.php
Created July 23, 2020 17:41 — forked from morsok/referer.php
Drupal 8 : Do something based on the referer if it's your website or another.
use Drupal\Core\Url;
use Symfony\Component\HttpFoundation\Request;
function my_function() {
$previousUrl = \Drupal::request()->server->get('HTTP_REFERER');
$fake_request = Request::create($previousUrl);
$url_object = \Drupal::service('path.validator')->getUrlIfValid($fake_request->getRequestUri());
if ($url_object) {
$route_name = $url_object->getRouteName();
// Do something with $route_name;
@jcicero518
jcicero518 / vanilla-fitvids.js
Created June 6, 2019 17:06 — forked from ebinion/vanilla-fitvids.js
FitVids ES6 & AMD ready
// Vanilla version of FitVids
// Still licencened under WTFPL
//
// Not as robust and fault tolerant as the jQuery version.
// And also, I don't support this at all whatsoever.
const vanillaFitVids = () => {
// List of Video Vendors embeds you want to support
const players = [
'iframe[src*="youtube.com"]',
@jcicero518
jcicero518 / ICS.php
Created May 23, 2019 16:28 — forked from jakebellacera/ICS.php
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* ICS.php
* =======
* Use this class to create an .ics file.
*
* Usage
* -----
* Basic usage - generate ics file contents (see below for available properties):
/**
* @license MIT, GPL, do whatever you want
* @requires polyfill: Array.prototype.slice fix {@link https://gist.github.com/brettz9/6093105}
*/
if (!Array.from) {
Array.from = function (object) {
'use strict';
return [].slice.call(object);
};
}
@jcicero518
jcicero518 / appEntryPoint.js
Created March 20, 2018 16:52 — forked from markerikson/appEntryPoint.js
Webpack React/Redux Hot Module Reloading (HMR) example
import React from "react";
import ReactDOM from "react-dom";
import configureStore from "./store/configureStore";
const store = configureStore();
const rootEl = document.getElementById("root");
@jcicero518
jcicero518 / react-file-upload.js
Created February 10, 2018 19:36 — forked from AshikNesin/react-file-upload.js
Simple React File Upload
import React from 'react'
import axios, { post } from 'axios';
class SimpleReactFileUpload extends React.Component {
constructor(props) {
super(props);
this.state ={
file:null
}