Skip to content

Instantly share code, notes, and snippets.

View philJohnson's full-sized avatar

Phillip Johnson philJohnson

  • Prezzee
  • Bli Bli, Qld
View GitHub Profile
@philJohnson
philJohnson / LanguageSelector.tsx
Created June 16, 2021 07:04
Polylang Language Selector
import React from 'react';
import { StaticQuery, graphql } from 'gatsby';
import { StyledLocationSelector, StyledList } from './styles';
export const LanguageSelector: React.StatelessComponent<any> = ({language}) => (
<StaticQuery
query={graphql`
query Languages {
@philJohnson
philJohnson / main.js
Created February 2, 2021 07:09
Setup Google map with custom styles
// import external dependencies
import forEach from 'lodash/forEach';
import styles from "./styles";
const init = (selector, callback) => forEach(document.querySelectorAll(selector), callback);
init('[data-map]', (el) => {
let map;
@philJohnson
philJohnson / OpenTable
Created May 24, 2019 05:54
Open table embed
<div class="embed-code"> <script type="text/javascript" src="//www.bookarestaurant.com/widget/IncludeBookingWidget/5644/Iki-jime/3/en-AU/1/600/400?PrimaryTextColour=000000&amp;SecondaryTextColour=ffffff&amp;WidgetBackgroundColour=eeeeee&amp;PrimaryWidgetColour=3452ff&amp;BackNavigationButtonsColour=cccccc&amp;SelectableOptionsColour=eeeeee&amp;CalAvailableDateColour=333333&amp;CalBGAvailableColour=ffffff&amp;CalBGUnAvailableColour=ffffff&amp;CalUnAvailableDateColour=a9a9a9&amp;CalendarHeaderTextColor=333333&amp;CalendarHeaderGridColour=dedede&amp;FontName=Arial, Helvetica, sans-serif&amp;HeaderImage=/resources.ashx/RestaurantImages/CpZ9MSshKEmWkr2uxY4Dgg.75.400.75.400.100/Image/59F7A32D59F2414BDF7C1DFF90E821F4/Booking2.png&amp;WidgetSpritesID=2&amp;BARLogoID=4&amp;IsSpecialRequestsRequired=false&amp;MinPartySize=1&amp;MaxPartySize=10&amp;IsAvTimeSlot=false&amp;IsHideRestaurantTitle=true&amp;IsShowTermsAndConditions=false&amp;IsOptInRestaurantEmailMarketing=False"></script>
@philJohnson
philJohnson / OpenTable
Created May 24, 2019 05:54
Open table embed
<div class="embed-code"> <script type="text/javascript" src="//www.bookarestaurant.com/widget/IncludeBookingWidget/5644/Iki-jime/3/en-AU/1/600/400?PrimaryTextColour=000000&amp;SecondaryTextColour=ffffff&amp;WidgetBackgroundColour=eeeeee&amp;PrimaryWidgetColour=3452ff&amp;BackNavigationButtonsColour=cccccc&amp;SelectableOptionsColour=eeeeee&amp;CalAvailableDateColour=333333&amp;CalBGAvailableColour=ffffff&amp;CalBGUnAvailableColour=ffffff&amp;CalUnAvailableDateColour=a9a9a9&amp;CalendarHeaderTextColor=333333&amp;CalendarHeaderGridColour=dedede&amp;FontName=Arial, Helvetica, sans-serif&amp;HeaderImage=/resources.ashx/RestaurantImages/CpZ9MSshKEmWkr2uxY4Dgg.75.400.75.400.100/Image/59F7A32D59F2414BDF7C1DFF90E821F4/Booking2.png&amp;WidgetSpritesID=2&amp;BARLogoID=4&amp;IsSpecialRequestsRequired=false&amp;MinPartySize=1&amp;MaxPartySize=10&amp;IsAvTimeSlot=false&amp;IsHideRestaurantTitle=true&amp;IsShowTermsAndConditions=false&amp;IsOptInRestaurantEmailMarketing=False"></script>
@philJohnson
philJohnson / nginx
Created July 31, 2017 01:40
Nginx for FC
# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/futureclassic.com.au/before/*;
server {
listen 80;
listen [::]:80;
server_name futureclassic.com.au;
root /home/forge/futureclassic.com.au/www/web;
#!/bin/bash
# Generates a cover image along with mute web-ready WebM and MP4 files for each master video in a folder.
# See: https://gist.github.com/jaydenseric/220c785d6289bcfd7366.
# Parameter 1: Input video format (e.g. "mov").
# Parameter 2: Output width in pixels (e.g. "1280").
# Example use: "./video4web.sh mov 1280".
for i in *.$1
@import "partials/unsemantic-grid-responsive";
@import "partials/mixins";
@import "partials/reset";
@import "partials/colours";
@import "partials/text";
@import "partials/button";
@import "partials/form";
body#tinymce{
height: auto;
@philJohnson
philJohnson / functions.php
Created September 11, 2015 01:18
Custom WYSIWYG css
function my_mce_css() {
return get_bloginfo('template_url').'/css/editor-style.css';
}
add_filter( 'mce_css', 'my_mce_css' );
@philJohnson
philJohnson / quote.php
Last active September 30, 2015 04:16
Content blocks example
<div class="quote-container">
<span class="quote"><?php the_sub_field('quote');?></span>
<?php $Path=$_SERVER['REQUEST_URI'];
$URI=get_site_url().$Path;
?>
<span class="share-link">
<a class="uppercase" href="https://www.facebook.com/sharer/sharer.php?u=<?PHP echo $URI;?>" rel="nofollow" target="delivery" onclick="return window.open('','delivery','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=no,scrollbars=yes,width=780,height=700')">Share quote on facebook</a>
<a class="uppercase" href="https://twitter.com/home?status=<?php echo urlencode(get_sub_field('quote') . " - " . $URI); ?>" rel="nofollow" target="delivery" onclick="return window.open('','delivery','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=no,scrollbars=yes,width=780,height=700')">Share quote on twitter</a>
</span>
</div>
@philJohnson
philJohnson / functions.php
Last active September 30, 2015 04:08
Tiny MCE advanced formats
function my_mce_css() {
return get_bloginfo('template_url').'/css/editor-style.css';
}
add_filter( 'mce_css', 'my_mce_css' );
add_filter( 'tiny_mce_before_init', 'my_mce_before_init_insert_formats' );
function my_mce_before_init_insert_formats( $settings ) {