Skip to content

Instantly share code, notes, and snippets.

View kenakingkong's full-sized avatar
🦎

Makena Kong kenakingkong

🦎
View GitHub Profile
@kenakingkong
kenakingkong / actiontext.scss
Last active April 19, 2024 17:37
Trix Editor - Stimulus Controller and CSS styles
/* https://medium.com/@makenakong/how-to-add-and-customize-the-trix-editor-for-your-ruby-on-rails-application-c0a5d3082254 */
.trix-button--icon-strike,
.trix-button--icon-link,
.trix-button-group--block-tools,
.trix-button-group--file-tools,
.trix-button-group--history-tools {
display: none;
}
@kenakingkong
kenakingkong / convert_to_webp.py
Created June 1, 2023 07:06
convert images to webp format
import os
from PIL import Image
from optparse import OptionParser
"""
Convert to webp
This script convert image(s) to webp format
- Accepts png, jpg, jpeg formats
- Given an image, converts image to webp
import type { AppProps } from 'next/app'
import Script from 'next/script'
import * as snippet from '@segment/snippet'
function App({ Component, pageProps }: AppProps) {
const loadSegment = () => {
const options = {
apiKey: process.env.NEXT_PUBLIC_SEGMENT_WRITE_KEY
}
if (process.env.NEXT_PUBLIC_NODE_ENV) {
// excerpt from src/scss/text.scss
...
.text {
&-purple { color: $purple }
&-regular {
font-family: $font-bowlby;
font-size: calc(18px + (26–14) * ((100vw - 300px) / (1600–300)));
padding: 0 1rem;
margin: 0;
// excerpt from src/components/mycard.js
...
<p
className="card-content"
dangerouslySetInnerHTML={{
__html: poem.content.replace(/<figure.+figure>/g,"")
}}
/>
...
//excerpt from gatsby-config.js
...
plugins: [
{
resolve: 'gatsby-plugin-web-font-loader',
options: {
google: {
families: ['Bowlby One', 'Noto Serif']
}
}
//excerpt from gatsby-config.js
...
plugins = [
{
resolve: 'gatsby-medium-rss-feed',
options: {
nodeType: 'sourceNodes',
name: 'MediumFeed',
userName: 'ThomKaar'
}
//excerpt from gatsby-config.js
...
plugins = [
{
resolve: `gatsby-plugin-s3`,
options: {
bucketName: '<bucket-name>',
region: '<bucket-region>'
},
}
import * as React from "react"
import { MediaContextProvider } from "./src/media"
export const wrapRootElement = ({ element }) => (
<MediaContextProvider>{element}</MediaContextProvider>
)
// src/media.js
import { createMedia } from "@artsy/fresnel"
const QueryBreakpoints = createMedia({
breakpoints: {
xs: 0,
sm: 768,
md: 1000,
lg: 1200,