Skip to content

Instantly share code, notes, and snippets.

View IanMitchell's full-sized avatar
💭
Brainstorming something new!

Ian Mitchell IanMitchell

💭
Brainstorming something new!
View GitHub Profile
@IanMitchell
IanMitchell / blog_post.txt
Last active March 13, 2024 16:44
Code Syntax Example
```tsx title="pages/register.tsx"
import { Fragment, useEffect, useState } from "react"; // [!code ++]
import { supported } from "@github/webauthn-json"; // [!code ++]
export default function Register() {
const [username, setUsername] = useState("");
const [email, setEmail] = useState("");
const [isAvailable, setIsAvailable] = useState<boolean | null>(null); // [!code ++]
useEffect(() => { // [!code ++]
@IanMitchell
IanMitchell / blog_post.mdx
Created March 13, 2024 16:31
Code Syntax Example
+import { Fragment, useEffect, useState } from "react";
+import { supported } from "@github/webauthn-json";


export default function Register() {
  const [username, setUsername] = useState("");
  const [email, setEmail] = useState("");
+  const [isAvailable, setIsAvailable] = useState<boolean | null>(null);
> wow
> i feel left out now
@IanMitchell
IanMitchell / rails-ujs.js
Last active May 8, 2020 18:30
Rails UJS
(function (factory) {
typeof define === 'function' && define.amd ? define(factory) :
factory();
}((function () { 'use strict';
const Rails = {
// Link elements bound by rails-ujs
linkClickSelector:
'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]',
[Enter steps to reproduce:]
1. ...
2. ...
**Atom**: 1.21.0 x64
**Electron**: 1.6.9
**OS**: Mac OS X 10.12.6
**Thrown From**: Atom Core
@IanMitchell
IanMitchell / example.rb
Created July 11, 2017 02:53
Minitest Stumbling Block
class A
def b(params)
payload = config.merge(params)
uri = get_endpoint
Net::HTTP.post(uri, payload)
end
end
# Wanted to test A::b by stubbing out Net::HTTP and examining what it was being called with.
# Maybe not the best way of approaching the test, but seemed logical to me. Ended up with the
@IanMitchell
IanMitchell / _document.js
Created January 19, 2017 17:41
Custom Script Tags using Next.js
import Document, { Head, Main, NextScript } from 'next/document'
export default class CustomDocument extends Document {
static async getInitialProps (ctx) {
return await Document.getInitialProps(ctx)
}
render () {
return (
<html>
<Head>
@IanMitchell
IanMitchell / component.js
Created December 26, 2016 04:31
React Events
export default class extends React.Component {
constructor(props) {
super(props)
this.state = { menuActive: false }
this.toggleNavigation = this.toggleNavigation.bind(this)
this.closeNavigation = this.closeNavigation.bind(this)
}
componentDidMount() {
document.body.addEventListener('click', this.closeNavigation)
@IanMitchell
IanMitchell / jekyll_seo
Created December 14, 2016 21:39
Jekyll SEO + Footnote
<!-- Begin Jekyll SEO tag v2.1.0 -->
<title>Welcome to Jekyll! - Your awesome title</title>
<meta property="og:title" content="Welcome to Jekyll!" />
<meta name="description" content="You’ll find this post in your _posts directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run jekyll serve, which launches a web server and auto-regenerates your site when a file is updated.1 This shouldn’t be included in the SEO description, but it will be. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris tristique odio eu lectus scelerisque, sed accumsan elit tincidunt. Vestibulum scelerisque est ut ante aliquet vestibulum. Phasellus egestas quam velit. Aliquam sit amet placerat lacus. Sed vitae tortor condimentum, dignissim ipsum nec, hendrerit enim. Pellentesque ornare risus metus, sit amet ultricies lorem commodo et. In non ipsum consequat, imperdiet nisl rutrum, blandit ex. Integer commodo nulla nec odio ul
@IanMitchell
IanMitchell / concat.rb
Created June 5, 2016 18:43
Concat Plugin for Jekyll
module Jekyll
module ConcatFilter
# Public: Combines two arrays
#
# first_array - The initial Array to use
# second_array - The Array to add
#
# Examples
#
# {{ site.data.disney_movies | concat: site.data.pixar_movies }}