Skip to content

Instantly share code, notes, and snippets.

View techiediaries's full-sized avatar

Techiediaries techiediaries

View GitHub Profile
@techiediaries
techiediaries / react-createroot.md
Last active June 21, 2022 01:42
React 18 createRoot example
import React from 'react';
import { createRoot }  from 'react-dom/client';

const App = ()=> <h1>React 18</h1>

const root = createRoot( document.getElementById("root") );
root.render( <App /> );
@techiediaries
techiediaries / angular-14-new-features.md
Last active June 21, 2022 01:07
The new features introduced with Angular 14

Angular 14 was released in June 2022 and includes various new features that will assist to reduce code complexity, make it more type-safe, decrease needless code size, and be more supporting in raising errors/warnings if something wrong occurs in templates.

Below are the hottest features:

1# Standalone Components/Pipes/Directive

import { Component } from "@angular/core";

@Component({
@techiediaries
techiediaries / employees.json
Created May 6, 2021 15:08 — forked from rominirani/employees.json
Employees JSON data format for populating the Employee documents in the Search Index
{
"Employees" : [
{
"userId":"rirani",
"jobTitleName":"Developer",
"firstName":"Romin",
"lastName":"Irani",
"preferredFullName":"Romin Irani",
"employeeCode":"E1",
"region":"CA",
{ "articles": [
{
"source": { id: "techcrunch", name: "TechCrunch" },
author: "Brian Heater",
title: "Smartphone shipments jumped 27% globally in Q1",
description: "More good news from a smartphone market currently rebounding from the far reaching impacts of the pandemic. New numbers from Canalys put global shipments for Q1 2021 at 27% above where they were the same time last year. The industry was hit early and hit hard…",
url: "https://techcrunch.com/2021/04/29/smartphone-shipments-jumped-27-globally-in-q1/",
urlToImage: "https://techcrunch.com/wp-content/uploads/2021/03/GettyImages-1209693436.jpg?w=667",
publishedAt: "2021-04-29T14:07:15Z",
content: "More good news from a smartphone market currently rebounding from the far reaching impacts of the pandemic. New numbers from Canalys put global shipments for Q1 2021 at 27% above where they were the … [+1484 chars]"
@techiediaries
techiediaries / app.component.ts
Last active February 12, 2020 03:55
Angular 9 fromEvent example
import {AfterViewInit, Component, ElementRef, OnInit, ViewChild} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import 'rxjs/add/observable/fromEvent';
@Component({
selector: 'app',
template: `
<p>
App works!
<button #btn> Click </button>
import wx
import urllib.request
import json
import webbrowser
API_KEY = ''
class NewsPanel1(wx.Panel):
def __init__(self, parent):
.calculator {
border: 1px solid #ccc;
border-radius: 5px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 400px;
}
import React from 'react'
import axios from 'axios';
class FileUploadForm extends React.Component {
UPLOAD_ENDPOINT = 'http://127.0.0.1:8000/upload.php';
constructor(props) {
super(props);
this.state ={
file:null
import React from 'react'
import axios from 'axios';
class FileUploadForm extends React.Component {
UPLOAD_ENDPOINT = 'http://127.0.0.1:8000/upload.php';
constructor(props) {
super(props);
this.state ={
file:null
@techiediaries
techiediaries / php-upload-file.php
Created April 28, 2019 22:22
PHP File Upload Example
<?php
header('Content-Type: application/json; charset=utf-8');
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: PUT, GET, POST");
$response = array();
$upload_dir = 'uploads/';
$server_url = 'http://127.0.0.1:8000';