Skip to content

Instantly share code, notes, and snippets.

Avatar
🌍

Sid Edwards sidedwards

🌍
View GitHub Profile
@sidedwards
sidedwards / translate.ts
Created Oct 26, 2021
Pseudo-translate your JSON files!
View translate.ts
import { parse } from "https://deno.land/std@0.113.0/flags/mod.ts"
import { v4 } from "https://deno.land/std@0.113.0/uuid/mod.ts";
const ARGS = parse(Deno.args)
const PATH = ARGS.path ?? null
const NODE = ARGS.node ?? 'content'
const FORMAT = ARGS.format ?? 'json'
const TYPE = ARGS.type ?? 'pseudo'
const DIRECTORY = PATH ?? Deno.cwd()+'/'
const CHARS = {
View 00-instructions.md

Description

A script that posts a daily quote and image to Discord via webhook.

Setup

  1. Install deno
  2. Create a new Discord webhook, copy URL, and update webhookURL value.
  3. Create a Pexels account, generate an API key, and update pexelsAPIKey value.

Usage

  1. Manually run deno run --allow-net daily-quote.ts
@sidedwards
sidedwards / input.scss
Created Sep 11, 2020
Generated by SassMeister.com.
View input.scss
h3 {
font-size: 20px;
margin-bottom: 10px;
.some-parent-selector & {
font-size: 24px;
margin-bottom: 20px;
}
}
View gist:1d2a80c9fd41f0657ac48685ae0a3bb9
by GTP-3
Philosophers have been trying for decades to make computers think like humans. The problem is that there is no good way to do it, since human thinking involves concepts like intentionality, agency, and so forth. If you try to program a computer with these things, it will never work right. Even if you could get a computer to understand what you were saying, it would still probably interpret your words incorrectly or completely ignore them entirely. You might as well be talking to a brick wall.
But then something strange happened recently. A team of researchers at Google DeepMind published a paper about their attempts to teach a computer to think like a philosopher. They called it GPT-1, and it described how they had built an AI system that could learn philosophical ideas by reading texts written by philosophers. It took them five years to train the system, and it eventually learned some very complex ideas about logic, metaphysics, and epistemology.
The idea behind this approach is that philosophy i
View translations-upgrade-3.2.md

Translations Upgrade Workflow (3.1 => 3.2)

Important Notes:

Craft 3.2 introduces a new Draft service that allows drafts to be created for all elements instead of being Entry specific. Unfortunately, with this new draft service the original draftIds from the entrydrafts table are not retained. Due to this fundamental restructuring of how Craft handles its Drafts, we are unable to retain any drafts created with previous versions of the plugin.

We apologize and understand the inconvenience, and did everything we could to prevent this scenario, but due to the nature of this change in Craft, we were unable to preserve existing drafts.

We strongly recommend completing all existing translation orders and publishing their drafts prior to upgrading. If you're unable to complete these orders, please reference this gist which will show you how to [create a list of Entries along with their target sites](https://gist.g

@sidedwards
sidedwards / boxfile.yml
Created Mar 26, 2019
Nanobox boxfile.yml for Sage 9 Wordpress
View boxfile.yml
run.config:
engine: php
engine.config:
runtime: php-7.2
extensions:
- gd
- mysqli
- curl
- zlib
- mbstring
View newJournalEntry.js
api.addButtonToToolbar({
title: 'New Journal Entry',
icon: 'book',
shortcut: 'alt+j',
action: async function() {
const todayDateStr = api.formatDateISO(new Date());
const todayEntry = await api.runOnServer(async todayDateStr => {
return await api.getDateNote(todayDateStr);
}, [todayDateStr]);
@sidedwards
sidedwards / description.md
Last active Dec 3, 2018
Hide Sidebar in Craft 3 Control Panel
View description.md

Hide sidebar in Craft 3 _layouts/cp

Snippet for hiding the sidebar in the Craft 3 control panel for Element index pages.

Since the Craft 3 sidebar handles the index source for querying elements it can be tricky disabling the sidebar and still executing the query.

This uses a twig macro to duplicate the sidebar and hide it while still being able to pass an index source for the query.

See the Craft templates/_layouts/cp.html file for more layout information

@sidedwards
sidedwards / breadcrumbs.html
Created Jul 22, 2017
Breadcrumb navigation in Craft CMS
View breadcrumbs.html
<div class="breadcrumbs">
<ul class="nav-list">
<li class="nav-item"><a href="/">Home</a></li>
{% set totalCrumbs = craft.request.getSegments() | length %}
{% for crumb in craft.request.getSegments() %}
{% if loop.index == totalCrumbs %}
<li class="nav-item"><a href="{{craft.request.getUrl()}}">{{crumb | capitalize}}</a></li>
{% else %}
<li class="nav-item"><a href="{{craft.request.getUrl() | split('/' ~ craft.request.getSegment(loop.index + 1))[0]}}">{{crumb | capitalize}}</a></li>
{% endif %}
View iTerm aliases
# grc overides for ls
if $(gls &>/dev/null)
then
alias ls="gls -F --color"
alias l="gls -lAh --color"
alias ll="gls -l --color"
alias la='gls -A --color'
fi
# Easier CD navigation