Skip to content

Instantly share code, notes, and snippets.

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 'whatwg-fetch';
import MediumEditor from 'medium-editor';
import Citation from './citation.js';
class BookCitation extends Component {
constructor( props ) {
super( props )
this.state = {
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():
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()
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,
@jkhaui
jkhaui / [1] convert_to_html.js
Created March 29, 2019 10:47 — forked from nathansmith/[1] convertToMarkup.js
Handy utilities for dealing with `<div contenteditable="true">` areas.
/*
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
@jkhaui
jkhaui / python-es6-comparison.md
Created September 17, 2019 07:02 — forked from revolunet/python-es6-comparison.md
# Python VS ES6 syntax comparison

Python VS ES6 syntax comparison

Python syntax here : 2.7 - online REPL

Javascript ES6 via Babel transpilation - online REPL

Imports

import math
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
/* Facebook */
:root, .__fb-light-mode {
--fds-active-icon: #3578E5;
--fds-attachment-footer-background: #F2F3F5;
--fds-black: #000000;
--fds-black-alpha-05: rgba(0, 0, 0, 0.05);
--fds-black-alpha-10: rgba(0, 0, 0, 0.1);
--fds-black-alpha-15: rgba(0, 0, 0, 0.15);
--fds-black-alpha-20: rgba(0, 0, 0, 0.2);
--fds-black-alpha-30: rgba(0, 0, 0, 0.3);
@jkhaui
jkhaui / auth
Created September 3, 2020 00:43

@using Microsoft.AspNetCore.Authentication;
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@model Pikcha.Services.Auth.Identity.API.Models.AccountViewModels.AuthenticationViewModel
@{
var returnUrl = ViewData["ReturnUrl"];
var externalLoigns = (IList<AuthenticationScheme>)ViewData["ExternalLogins"];
var page = ViewData["Page"] ?? "register";