This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from "react"; | |
type ItemType = { | |
id: Number; | |
title: String; | |
children: Array<Number>; | |
}; | |
// Each "ItemType" element in the array have a array of children ID's. These refer | |
// to a ItemType. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import _ from 'lodash'; | |
/* | |
HOC to feed breakpoints data to child component. | |
Breakpoint data is based on Bootstrap's breakpoints | |
Using lodash throttle to optimize the high rate of events being fired. | |
*/ | |
export const Breakpoints = (WrappedComponent) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NOTE: This component requires React 16 or newer. | |
// Usage: | |
/* | |
<Position | |
parent={<div>Parent element</div>} | |
target={ (style) => ( | |
<div style={style}>Popper element</div> | |
)} | |
options={{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { withStyles, createStyleSheet } from 'material-ui/styles'; | |
import Tabs, { Tab } from 'material-ui/Tabs'; | |
import Paper from 'material-ui/Paper'; | |
const TabStylesheet = createStyleSheet(theme => ({ | |
root: { | |
backgroundColor: theme.palette.background.paper, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import tether.js | |
// We also add 'global.Tether' as a workaround for Meteor. | |
import tether from 'tether'; | |
global.Tether = tether; | |
// Import Bootstrap js. | |
bootstrap = require('bootstrap'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Confirmation modal on elements that have 'confirm' class. | |
// Will launch a modal and ask for confirmation. | |
// data-confirm-action="confirm" - Will enable the confirm modal | |
// data-confirm-title="" - Custom title, optional | |
// data-confirm-text="" - Custom modal text, optional. | |
;(function ( $, window, document, undefined ) { | |
// Create the defaults once | |
var pluginName = "confirmAction", | |
defaults = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Based on: http://stackoverflow.com/a/878331 | |
Filter child select from selected parent select option. | |
Will look for parent (options) value in child data-parent"XX". | |
<select id="parent"> | |
<option value="1">Group 1</option> | |
<option value="2">Group 2</option> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Source: http://www.wpbeginner.com/wp-tutorials/55-most-wanted-wordpress-tips-tricks-and-hacks/ ?> | |
<?php include_once(ABSPATH.WPINC.'/feed.php'); | |
$rss = fetch_feed('http://feeds.feedburner.com/wpbeginner'); | |
$maxitems = $rss->get_item_quantity(5); | |
$rss_items = $rss->get_items(0, $maxitems); | |
?> | |
<ul> | |
<?php if ($maxitems == 0) echo '<li>No items.</li>'; | |
else | |
// Loop through each feed item and display each item as a hyperlink. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.datepicker.regional['sv'] = { | |
closeText: 'Stäng', | |
prevText: '< Föregående', | |
nextText: 'Nästa >', | |
currentText: 'Nu', | |
monthNames: ['Januari','Februari','Mars','April','Maj','Juni','Juli','Augusti','September','Oktober','November','December'], | |
monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun','Jul','Aug','Sep','Okt','Nov','Dec'], | |
dayNamesShort: ['Sön','Mån','Tis','Ons','Tor','Fre','Lör'], | |
dayNames: ['Söndag','Måndag','Tisdag','Onsdag','Torsdag','Fredag','Lördag'], | |
dayNamesMin: ['Sö','Må','Ti','On','To','Fr','Lö'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (isset($_GET['activated']) && is_admin()){ | |
$new_page_title = 'This is the page title'; | |
$new_page_content = 'This is the page content'; | |
$new_page_template = ''; //ex. template-custom.php. Leave blank if you don't want a custom page template. | |
$page_check = get_page_by_title($new_page_title); | |
$new_page = array( | |
'post_type' => 'page', | |
'post_title' => $new_page_title, | |
'post_content' => $new_page_content, | |
'post_status' => 'publish', |
NewerOlder