Skip to content

Instantly share code, notes, and snippets.

🦈
47

Ben Read endymion1818

🦈
47
Block or report user

Report or block endymion1818

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@endymion1818
endymion1818 / pre-commit
Created Oct 4, 2019
protected branches (git hook)
View pre-commit
#!/bin/bash
protected_branches=( production master )
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
for i in "${protected_branches[@]}"
do
protected_branch=$i
@endymion1818
endymion1818 / settings.json
Last active Sep 26, 2019
VSCode settings
View settings.json
{
"terminal.integrated.shell.osx": "/bin/zsh",
"editor.wordWrap": "on",
"references.preferredLocation": "view",
"workbench.panel.defaultLocation": "right",
"peacock.favoriteColors": [
{
"name": "Zopa Teal",
"value": "#00B9A7"
},
View evenColumns.tsx
import React, {FC} from 'react'
import Column from '../Atoms/Column'
import Row from '../Atoms/Row'
export interface IContentProps {
/**
* an array of objects with JSX elements
* @default <>&nbsp;</>
*/
innerContent: JSX.Element
View careers.js
import React from 'react'
import Link from '../../../components/library/Link'
import CareersTeamsMap from './CareersTeamsMap'
interface ICareersListProps {
data: object
}
const JobItem = item => (
<p>
View netmag-context-data
[
{
"_id": "5c4c278665e65c411445a158",
"index": 0,
"guid": "3d80eb64-3477-408a-997f-eb8fe2e0fb2a",
"isActive": true,
"about": "Et veniam sunt cillum occaecat dolor in ex sunt nulla anim deserunt cupidatat laborum. Consequat commodo laboris officia labore eiusmod enim pariatur deserunt. Qui minim ipsum incididunt pariatur elit ullamco dolore officia sunt sit cillum.",
"highValue": [
"5,763.60",
"2,185.52",
View webpagetest.md
Doc - Complete Fully - - Loaded
Load time First Byte Start Render Speed Index First Interactive Time Requests Bytes In Time Requests Bytes In Cost
@endymion1818
endymion1818 / query.php
Created Apr 11, 2018
Tribe Events custom taxonomy query
View query.php
<?php
$tribe = [
'post_type' => ['tribe_events'], // inside an array
'posts_per_page' => 3,
'tax_query' => [
'relation' => 'OR',
[
'taxonomy' => 'tribe_events_cat',
'field' => 'slug',
'terms' => [ 'your-term-slug' ],
@endymion1818
endymion1818 / collapseonlyifexists.js
Last active Oct 16, 2017
Toggle active state only if it exists
View collapseonlyifexists.js
window.onload = function() {
if (typeof(document.querySelector( ".btn-collapse" )) != 'undefined' && (document.querySelector( ".btn-collapse" )) != null) {
var collapselink = document.querySelector( ".btn-collapse" );
collapselink.addEventListener( "click", function() {
this.classList.toggle( "active" );
if(this.classList.contains('active')) {
this.innerHTML = "Hide";
} else {
this.innerHTML = "Show all";
}
@endymion1818
endymion1818 / component.js
Created Sep 13, 2017
react component foreach loop
View component.js
var list = this.state.list.logs.map((log, key) => {
return(
<View>
{log.map(logChild, key2) => {
return (<View key={key2}><Text>{logChild.toString()}</Text></View>)
}}
</View>
)
@endymion1818
endymion1818 / restrict-query-by-user-role
Last active Jul 19, 2017
restrict a query by user role based on category
View restrict-query-by-user-role
/*
* Restrict the for-teachers resource taxonomy
* So that it only shows to specified users
* Namely, admins, teachers and sixth form heads
*/
add_action('pre_get_posts', function($query){
if(!is_user_logged_in()) {
return;
}
You can’t perform that action at this time.