Skip to content

Instantly share code, notes, and snippets.

View inslayn's full-sized avatar
😶‍🌫️

Nick McVroom inslayn

😶‍🌫️
View GitHub Profile
@inslayn
inslayn / main.dart
Last active September 13, 2023 01:13
How to get the current web page url in a custom action (plus get route as a bonus)
// ----------------------- Action 1 ------------------------------
import 'dart:html' as html;
import 'package:flutter/src/foundation/constants.dart';
/// Gets the current URL of the current page of the application.
///
/// On web platforms, it returns the current URL.
///
/// On other platforms (e.g., mobile apps with deep linking), an empty string.

Keybase proof

I hereby claim:

  • I am inslayn on github.
  • I am inslayn (https://keybase.io/inslayn) on keybase.
  • I have a public key whose fingerprint is 1278 57E0 6B5F B105 F4BA E7CE DF0B 5859 0CC4 0B1A

To claim this, I am signing this object:

@inslayn
inslayn / LoadInitialSceneOnEditorPlay.cs
Last active September 1, 2018 23:07
Auto-boot your Unity game when entering Play mode
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine.SceneManagement;
namespace EternalConstruct.Editor.Utils
{
[InitializeOnLoad]
public static class LoadInitialSceneOnEditorPlay
{{! As Ghost supports Twitter Cards natively, all we need to add are the attribution links. }}
{{! 1. Don't forget to update the attribution links. }}
<meta name="twitter:site" content="@nytimes">
<meta name="twitter:creator" content="@SarahMaslinNir">
{{! 1. If we have a featured image, use the Summary Card with Large Image type }}
{{! If we don't have a featured image, use the Summary Card type }}
<meta name="twitter:card" content={{#if image}}"summary_large_image"{{else}}"summary"{{/if}}>
{{! 2. Don't forget to update the attribution links. }}
<meta name="twitter:site" content="@nytimes">
<meta name="twitter:creator" content="@SarahMaslinNir">
{{! 3. We set the content to the post's title, using the Handlebars tag }}
<meta name="twitter:title" content="{{{title}}}">
{{! 4. We set the content to an excerpt of the post's content, of a maximum of 26 words, using the Handlebars tag, followed by an ellipsis. }}
<meta name="twitter:description" content="{{excerpt words="26"}} &hellip;">
@inslayn
inslayn / ghost-of-twitter-cards-tutorial.hbs
Created April 16, 2016 01:01
ghost-of-twitter-cards-tutorial.hbs
{{#if image}}
{{! If we have a featured image, use the Summary Card with Large Image type }}
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@nytimes">
<meta name="twitter:creator" content="@SarahMaslinNir">
<meta name="twitter:title" content="Parade of Fans for Houston’s Funeral">
<meta name="twitter:description" content="NEWARK - The guest list and parade of limousines with celebrities emerging from them seemed more suited to a red carpet event in Hollywood or New York than than a gritty stretch of Sussex Avenue near the former site of the James M. Baxter Terrace public housing project here.">
<meta name="twitter:image" content="http://graphics8.nytimes.com/images/2012/02/19/us/19whitney-span/19whitney-span-articleLarge.jpg">
{{else}}
{{! If we don't have a featured image, use the Summary Card type }}