Skip to content

Instantly share code, notes, and snippets.

View imranhsayed's full-sized avatar
🖥️
Coding

Imran Sayed imranhsayed

🖥️
Coding
View GitHub Profile
// Online C compiler to run C program online
#include <stdio.h>
#include <stdlib.h>
struct Node {
int data; // Data for the node.
struct Node *nextPtr; // Stores address of the next note.
}*firstNode;
// Function to create the list
if ( has_post_thumbnail() ) {
$thumbnail = [];
$thumbnail_id = get_post_thumbnail_id();
/**
* Get the all data for the image.
* like the title, description, alt, etc.
*/
$args = [
'post_type' => 'attachment',
function save( props ) {
return wp.element.createElement(
'div',
{
id: props.attributes.id
},
props.attributes.content
);
}
<script src="https://fb.me/react-with-addons-15.1.0.js"></script>
<script src="https://fb.me/react-dom-15.1.0.js"></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
@imranhsayed
imranhsayed / index.js
Created April 4, 2019 19:05
RichText Component
const { registerBlockType } = wp.blocks;
const { RichText } = wp.editor;
const result = registerBlockType( 'myguten-block/test-block', {
title: 'Basic Example',
icon: 'smiley',
category: 'layout',
attributes: {
content: {
type: 'array',
@imranhsayed
imranhsayed / index.js
Last active April 4, 2019 10:32
InspectControl & ColorPalette
const { registerBlockType } = wp.blocks;
const { RichText, BlockControls, AlignmentToolbar,
InspectorControls, ColorPalette } = wp.editor;
const result = registerBlockType( 'myguten-block/test-block', {
title: 'Basic Example',
icon: 'smiley',
category: 'layout',
attributes: {
content: {
@imranhsayed
imranhsayed / index.js
Created April 3, 2019 09:03
InspectorControl and ColorPallete along with BlockControls
const { registerBlockType } = wp.blocks;
const { RichText, BlockControls, AlignmentToolbar,
InspectorControls, ColorPalette } = wp.editor;
registerBlockType( 'myguten-block/test-block', {
title: 'Basic Example',
icon: 'smiley',
category: 'layout',
attributes: {
content: {
@imranhsayed
imranhsayed / index.js
Last active April 3, 2019 09:02
BlockControl and AlignmentToolBar with ReactText Component
const { registerBlockType } = wp.blocks;
const { RichText, BlockControls, AlignmentToolbar } = wp.editor;
registerBlockType( 'myguten-block/test-block', {
title: 'Basic Example',
icon: 'smiley',
category: 'layout',
attributes: {
content: {
type: 'array',
<?php
/*
Plugin Name: My Gutenberg Block
*/
function my_custom_block_register_block() {
// Register JavasScript File build/index.js
wp_register_script(
'my-custom-block',
plugins_url( 'build/index.js', __FILE__ ),
// src/index.js
const { registerBlockType } = wp.blocks;
registerBlockType( 'myguten-block/test-block', {
title: 'Basic Example',
icon: 'smiley',
category: 'layout',
edit: ( { className } ) => <div className={ className }>Hello World!</div>,
save: () => <div>Hello World!</div>,
} );