Skip to content

Instantly share code, notes, and snippets.

View hamstu's full-sized avatar
🤩

Hamish Macpherson hamstu

🤩
View GitHub Profile
export async function summarizeThread(
thread: Thread,
authorName: string
): Promise<CreateChatCompletionResponse> {
const allTextFromThread = thread.blocks
.map((block) => block.plaintext)
.join("\n");
const openai = await OpenAI.getClient();
const completion = await openai.createChatCompletion({
model: "gpt-3.5-turbo",
[alias]
branch-cleanup = "!git branch --merged | egrep -v \"(^\\*|master|dev)\" | xargs git branch -d #"
ca = !git add -A && git commit -av
s = status -s
l = log --pretty=oneline -n 20 --graph --abbrev-commit
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
la = "!git config -l | grep alias | cut -c 7-"
ca = !git add -A && git commit -av
co = checkout
@hamstu
hamstu / arc-switch-space.sh
Created April 3, 2024 15:48
Arc Switch Space Script
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Arc <NAME OF SPACE>
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 🚀
# @raycast.packageName Arc
@hamstu
hamstu / intercept-file.js
Created June 10, 2020 03:18
Electron file:// intercept
const path = require('path');
const { protocol } = require('electron');
/**
* This method is used to intercept file requests from the Electron
* BrowserWindow ensure we load the correct files.
*
* This allows us to intercept requests from the JavaScript that ask for
* resources with absolute paths, e.g., `/web_modules/react.js`. Without
* the intercept, Electron would attempt (and fail) to load from the
@hamstu
hamstu / .hyperterm.js
Last active September 19, 2016 17:59
HyperTerm Settings
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 18,
// font family with optional fallbacks
fontFamily: 'Input, Menlo, "DejaVu Sans Mono", "Lucida Console", monospace',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: 'rgba(248,28,229,0.75)',
@hamstu
hamstu / parallax.js
Last active February 7, 2024 15:20
Parallax Example: JavaScript
var ParallaxManager, ParallaxPart;
ParallaxPart = (function() {
function ParallaxPart(el) {
this.el = el;
this.speed = parseFloat(this.el.getAttribute('data-parallax-speed'));
this.maxScroll = parseInt(this.el.getAttribute('data-max-scroll'));
}
ParallaxPart.prototype.update = function(scrollY) {
@hamstu
hamstu / style.css
Created December 17, 2014 19:09
Parallax Example: CSS
body {
background: #415a6c;
margin: 0;
font-family: 'Oswald';
}
.parallax-container {
position: fixed;
overflow: visible;
width: 100%;
height: 850px;
@hamstu
hamstu / parallax.html
Last active July 31, 2021 15:12
Parallax Effect: HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Parallax Example</title>
<link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="style.css">
</head>
<body>
+ : 27 > rvm --trace version
+ /scripts/cli : rvm() 2 > __rvm_has_opt posix
+ /scripts/base : __rvm_has_opt() 1 > [[ -n '' ]]
+ /scripts/base : __rvm_has_opt() 3 > [[ -n 3.2.48(1)-release ]]
+ /scripts/base : __rvm_has_opt() 3 > [[ :braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor:xtrace: =~ :posix: ]]
+ /scripts/base : __rvm_has_opt() 5 > return 1
+ /scripts/cli : rvm() 854 > typeset result current_result
+ /scripts/cli : rvm() 855 > export -a rvm_ruby_args
+ /scripts/cli : rvm() 856 > rvm_ruby_args=()
+ /scripts/cli : rvm() 859 > (( 0 == 0 ))
##### starting test path_mismatch.
$ source "$rvm_path/scripts/rvm"
$ : test no error
$ rvm use 1.9.3 --install
Using /Users/hamstu/.rvm/gems/ruby-1.9.3-p448
# passed: status = 0
$ rvm version
rvm 1.21.14 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]