Python syntax here : 2.7 - online REPL
Javascript ES6 via Babel transpilation - online REPL
import math
Python syntax here : 2.7 - online REPL
Javascript ES6 via Babel transpilation - online REPL
import math
/* | |
You would call this when receiving a plain text | |
value back from an API, and before inserting the | |
text into the `contenteditable` area on a page. | |
*/ | |
define(function(require) { | |
'use strict'; | |
/* | |
Used to convert text with line breaks |
const withPlugins = require('next-compose-plugins'); | |
const withTM = require('next-plugin-transpile-modules'); | |
const withOptimizedImages = require('next-optimized-images'); | |
const withFonts = require('next-fonts'); | |
const withCSS = require('@zeit/next-css'); | |
module.exports = withPlugins( | |
[ | |
[ | |
withTM, |
from graphene import ObjectType, String, Field, Int | |
# Schema Objects | |
class CitationObject(ObjectType): | |
title = String() | |
oclc = Int() | |
language = String() | |
publisher = String() | |
city = String() | |
publish_year = Int() |
import graphene | |
class Query(graphene.ObjectType): | |
hello = graphene.String(name=graphene.Argument( | |
graphene.String, default_value="stranger"), age=graphene.Argument(graphene.Int)) | |
def resolve_hello(self, args, context, info): | |
return 'Hello {} you are {} years old'.format(args['name'], args['age']) | |
def main(): |
import React, { Component } from 'react'; | |
import 'whatwg-fetch'; | |
import MediumEditor from 'medium-editor'; | |
import Citation from './citation.js'; | |
class BookCitation extends Component { | |
constructor( props ) { | |
super( props ) | |
this.state = { |
add_action( 'graphql_register_types', function() { | |
register_graphql_field( 'Hashtag', 'hashtagImg', [ | |
'type' => 'String', | |
'description' => __( 'The image (URL) for a topic.', 'wp-graphql' ), | |
'resolve' => function( \WP_Term $term ) { | |
$topic_meta = get_term_meta( $term->id, '_topic_image', true ); | |
$img_post = wp_get_attachment_url( $topic_meta ); | |
return ! empty( $img_post ) ? $img_post : null; |
import React, { Component } from 'react'; | |
import { Form } from 'semantic-ui-react'; | |
class Filter extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
searchTerm: '' | |
} | |
this.updateSearchTerm = this.updateSearchTerm.bind(this); |
<?php | |
namespace Medium; | |
class Citation { | |
const SHORTCODE = 'medium-editor'; | |
private $url; | |
public function __construct() | |
{ | |
ini_set( 'display_errors', 1 ); |
$fields['seriesPart'] = [ | |
'type' => \WPGraphQL\Types::int(), | |
'description' => __( 'The number of the post within its series.' ), | |
'resolve' => function( \WP_Post $post ) { | |
$series_number = get_post_meta( $post->ID, '_series_part', true ); | |
return ! empty ( $series_number ) ? $series_mumber : null; | |
}, | |
]; |