Skip to content

Instantly share code, notes, and snippets.

View krishaamer's full-sized avatar
💭
:)

Kris Haamer krishaamer

💭
:)
View GitHub Profile
@levelsio
levelsio / gist:5bc87fd1b1ffbf4a705047bebd9b4790
Last active May 28, 2024 17:40
Secret of Monkey Island: Amsterdam (by @levelsio) or how to create your own ChatGPT image+text-based adventure game
# 2023-11-27 MIT LICENSE
Here's the open source version of my ChatGPT game MonkeyIslandAmsterdam.com.
It's an unofficial image+text-based adventure game edition of Monkey Island in Amsterdam, my home town.
Please use it however you want. It'd be nice to see more ChatGPT-based games appear from this. If you get inspired by it, please link back to my X https://x.com/levelsio or this Gist so more people can do the same!
Send me your ChatGPT text adventure game on X, I'd love to try it!
@ynagatomo
ynagatomo / SD2ContentView.swift
Created December 4, 2022 08:56
An iOS app that generates images using Stable-Diffusion-v2 CoreML models.
//
// ContentView.swift
// coremlsd2test
//
// Created by Yasuhito Nagatomo on 2022/12/03.
//
// A sample code using Apple/ml-stable-diffusion library.
// Preparation:
// 1. convert the PyTorch Stable-Diffusion v2 model to coreml models using Apple's tools.
// 2. import the coreml models into the iOS project.
import invariant from "tiny-invariant";
class AmalgoBox extends HTMLElement {
get input() {
return this.querySelector("input") as HTMLInputElement;
}
get button() {
return this.querySelector("button") as HTMLButtonElement;
}
import SwiftUI
import PlaygroundSupport
struct Sunset: View {
@State var backgroundColor = Color.blue
@State var sunSetted = false
let sunGradient = [Color.yellow, Color.orange]
let moonGradient = [Color.gray, Color.black]
@State var alignment = Alignment.top
@agmm
agmm / nextjs-file-upload-api.js
Created January 31, 2020 23:03
Simple Nextjs File Upload — Backend API
// Backend
import formidable from 'formidable';
export const config = {
api: {
bodyParser: false,
},
};
export default async (req, res) => {
@mlipscombe
mlipscombe / functions.php
Created May 28, 2019 00:50
Render Elementor-styled content in WP-GraphQL
add_action('graphql_register_types', function() {
$post_types = WPGraphQL::$allowed_post_types;
if (!empty($post_types) && is_array($post_types)) {
foreach($post_types as $post_type) {
$post_type_object = get_post_type_object($post_type);
register_graphql_field($post_type_object->graphql_single_name, 'styledContent', [
'type' => 'String',
'description' => __('The styled elementor content of the page', 'cottontailpress-headless'),
'resolve' => function($post) {
$content = '';
import React, { Component } from "react";
import axios from "axios";
import * as config from "../config.json";
import _ from "lodash";
import { StatusBar } from "@uppy/react";
import { DragDrop } from "@uppy/react";
import "@uppy/core/dist/style.css";
import "@uppy/drag-drop/dist/style.css";
import "@uppy/status-bar/dist/style.css";
import "./s3uploadComponent.css";
@Ifmr24
Ifmr24 / hooks2.js
Last active January 26, 2022 02:21
NextJS - React Hooks, useState, useEffect
import React, { useState, useEffect } from 'react';
export default () => {
// Definimos los estados
const [name, setName] = useState(String)
const [count, setCount] = useState(Number)
// Los estados definidos se pueden usar dentro de otras funciones
function obtenerName(){
console.log(name)
@daliborgogic
daliborgogic / functions.php
Last active July 25, 2019 19:06
Headless WordpPress REST API Change post preview button url
<?php
function pwa_preview_link() {
$slug = basename(get_permalink());
$pwadomain = 'https:/example.com';
$pwadir = '/';
$pwaurl = "$pwadomain$pwadir$slug";
return "$pwaurl";
}
add_filter('preview_post_link', 'pwa_preview_link');
@itsdavidmorgan
itsdavidmorgan / basic-block-styles.css
Last active October 7, 2022 14:05
WordPress Gutenberg Basic Block Styles
/************************************************
Audio Blocks
************************************************/
.wp-block-audio {
margin-left: 0px;
margin-right: 0px;
}
.wp-block-audio audio {
width: 100%;