Skip to content

Instantly share code, notes, and snippets.

View Ladvace's full-sized avatar
:octocat:
Focusing

Gianmarco Ladvace

:octocat:
Focusing
View GitHub Profile
const stringio = require('@rauschma/stringio');
const child = require('child_process');
const start = child.spawn(`java -Xms512M -Xmx1024M -jar ./TEST-FILE.jar`,
[], { shell: true });
async function writeToWritable(writable, data) {
console.log("WRITABLE", writable);
//await stringio.streamWrite(writable, data);
<script context="module">
// this script fetch the posts from the api
// https://svelte.dev/docs#script_context_module
// this is runned on load (check svelKit doc)
export async function load({ fetch }) {
let articles;
try {
// here you should type your dev.to username
<script context="module">
export async function load({ fetch, page }) {
let article;
try {
// here we are gonna fetch the single article by id
article = await fetch(`https://dev.to/api/articles/${page.params.slug}`);
article = await article.json();
} catch (e) {
import React, { useState } from 'react'
export const Component = () => {
const [show, setShow] = useState(false)
const handleClick = () => {
setShow(prev => !prev)
}
return (
import React, { useState } from 'react'
export const Component = () => {
const [show, setShow] = useState(false)
const handleClick = () => {
setShow(prev => !prev)
}
return (
import React, { useState } from 'react'
export const Component = (props) => {
return (
<div>
<p>{props.name}</p>
<p>{props.surname}</p>
<p>{props.age}</p>
<p>{props.location}</p>
import React, { useState } from 'react'
export const Component = ({name, age}) => {
return (
<div>
<h2>{name}</h2>
<p>{age}</p>
</div>
)
let obj = {}
const symbol1 = Symbol("a")
const symbol2 = Symbol("a")
const sharedSymbol = Symbol.for('b')
obj[symbol1] = 'a'
obj[sharedSymbol] = 'b'
obj['c'] = 'c'
Symbol('bar') === Symbol('bar') // false, each of them it's a unique id, the "bar" it's just a description and not an unique key
Symbol.for('foo'); // create a new global symbol
Symbol.for('foo'); // retrieve the already created symbol
Symbol.for('bar') === Symbol.for('bar') // true
<html>
<head>
<title>Party Coffee Cake</title>
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@type": "Recipe",
"name": "Party Coffee Cake",
"author": {
"@type": "Person",