Skip to content

Instantly share code, notes, and snippets.

View NickyMeuleman's full-sized avatar
🏎️
When not coding, I'm simracing

Nicky Meuleman NickyMeuleman

🏎️
When not coding, I'm simracing
View GitHub Profile
@NickyMeuleman
NickyMeuleman / layout.js
Created July 6, 2018 15:07
query for image in layout component
import React from 'react'
import { Link } from 'gatsby'
import { rhythm, scale } from '../utils/typography'
import { StaticQuery, graphql } from 'gatsby'
class Template extends React.Component {
render() {
const { location, children } = this.props
@NickyMeuleman
NickyMeuleman / settings.json
Created July 9, 2018 18:09
VSCode settings.json
{
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
"editor.fontSize": 18,
"terminal.integrated.fontSize": 18,
"editor.renderWhitespace": "all",
"window.menuBarVisibility": "toggle",
"editor.fontFamily": "Fira Code",
"editor.fontLigatures": true,
"terminal.integrated.fontFamily": "consolas",
"files.eol": "\n",

Markdown file

Created in VSCode, using the GistPad extension

Let's upload a screenshot from the clipboard, because I can

Apparently I can't. I'm on WSL2, maybe that's why, it's in my Windows clipboard

  • Making a list.
  • Checking it twice.
title
404 - Not Found

import TextLayout from '../components/text-layout.js'; import { Link } from "gatsby"; export default TextLayout;

Potato salad Page not found

let urlObj = new URL(`https://publish.twitter.com/oembed`);
urlObj.search = new URLSearchParams({
url: "https://twitter.com/NMeuleman/status/1211692091954339841",
theme: "dark",
dnt: true,
omit_script: true
});
const urlString = urlObj.toString();
// https://publish.twitter.com/oembed?url=https%3A%2F%2Ftwitter.com%2FNMeuleman%2Fstatus%2F1211692091954339841&theme=dark&dnt=true&omit_script=true
// Totally fine option that takes 2 lines
import { infiniteBooper } from "./some/other/file.js";
export { infiniteBooper };
// Same thing, done on a single line
export { infiniteBooper } from "./some/other/file.js";
/** @jsx jsx */
// import React from 'react';
import { jsx } from 'theme-ui';
import { Link, graphql } from 'gatsby';
import { PostCard } from '@nickymeuleman/gatsby-theme-blog';
import testImg from './test.jpg';
const IndexPage = ({ data }) => {
console.log(data);
@NickyMeuleman
NickyMeuleman / default-values.js
Last active February 28, 2020 15:07
logical OR vs nullish coalescing
const value = 0
const defaultWithLogicalOR = value || 1
// result: 1
const defaultWithNullishCoalescing = value ?? 1;
// result: 0
<template>
<div>
<!-- these two links are identical -->
<a v-bind:href="twitter">@NMeuleman</a>
<a :href="twitter">@NMeuleman</a>
</div>
</template>
<script>
export default {
<template>
<!-- pass in the "like" variable that corresponds to the input-value by using v-model -->
<form v-on:submit.prevent="onSubmit(like)">
<label
>What do you like:
<input v-model="like" />
</label>
<input type="submit" />
</form>
</template>