Skip to content

Instantly share code, notes, and snippets.

<?php
class Threader
{
private array $tweets, $roots;
private string $user;
public function handle(): void
{
echo "What is your twitter username? ";
@tnorthcutt
tnorthcutt / gist:c3c591b24dc48b56d04b03dc499bd163
Created February 23, 2021 17:13
Keyboard.io Model 01 custom firmware
// -*- mode: c++ -*-
// Copyright 2016 Keyboardio, inc. <jesse@keyboard.io>
// See "LICENSE" for license details
#ifndef BUILD_INFORMATION
#define BUILD_INFORMATION "locally built"
#endif
/**
@tnorthcutt
tnorthcutt / CommitHistory.vue
Last active September 10, 2020 17:09
Gridsome commit history
<template>
<div>
<h3>Revisions</h3>
<div class="space-y-4">
<div
v-for="commit in commits"
v-bind:key="commit.sha"
class="flex border-solid border border-gray-300 p-4"
>
<img
@tnorthcutt
tnorthcutt / index.php
Last active September 7, 2020 15:33 — forked from vsoch/index.php
Generate RSS feed for files in a directory folder. Put this file in a folder with files, modify the $allowed_ext variable to customize your extensions, and $feedName, $feedDesc, $feedURL, and $feedBaseURL. Then navigate to the folder on the web to see the xml feed. Done!
<?php
header('Content-type: text/xml');
/*
Runs from a directory containing files to provide an
RSS 2.0 feed that contains the list and modification times for all the
files.
*/
$feedName = "Name";
$feedDesc = "Description";
// in mixins/trailingSlash.js
export default (url) => {
return url.replace(/\/?$/, "/");
};
// in app.js
import trailingSlash from "./components/mixins/trailingSlash";
Vue.mixin({
methods: {
trailingSlash,
<?php
// ConvertKit API Key:
$convertkitApiKey = 'your-convertkit-api-key';
// Map each of your Clickbank products to a ConvertKit tag ID, or leave this array empty to
// use the default tag for all products:
$convertkitTags = array(
'clickbankproduct1' => 'cktag1',
'clickbankproduct2' => 'cktag2',
'clickbankproduct3' => 'cktag3',
);
@tnorthcutt
tnorthcutt / rm_mysql.md
Created April 24, 2019 14:52 — forked from vitorbritto/rm_mysql.md
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

brew remove mysql

@tnorthcutt
tnorthcutt / Member.php
Created April 11, 2019 22:13
Extending spatie/laravel-tags to limit to the current team in a Spark application
<?php
// Relevant parts of my Member.php model, which is the model that I'm applying tags to
/**
* Using our own Tag model
* @see https://docs.spatie.be/laravel-tags/v2/advanced-usage/using-your-own-tag-model
*
* @return string
*/
@tnorthcutt
tnorthcutt / app.blade.php
Created December 10, 2018 01:02
Limiting user tracking in a Laravel Spark app to real users signed into the app (not admins or admins impersonating a user)
<script>
<?php if (Auth::user() && Spark::developer(Auth::user()->email) || session('spark:impersonator')) {
?> Spark.state.devmode = true; <?php
} else {
?> Spark.state.devmode = false; <?php
} ?>
if (Spark.state.user && !Spark.state.devmode) {
// Intercom, FullStory, etc. tracking goes here
}
setPluginUrl() {
// Deleting the default header
delete window.axios.defaults.headers.common['X-CSRF-TOKEN'];
// Calling the method that fetches the data from Github
this.fetchUrl().then(data => {
this.pluginUrl = data;
});
// Reset the axios default headers