Skip to content

Instantly share code, notes, and snippets.

View alexandrosm's full-sized avatar

Alexandros Marinos alexandrosm

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<title>Chat with GPT</title>
<style>
#chatbox {
width: 500px;
height: 500px;
border: 1px solid black;
overflow: auto;
class ScriptRunner {
constructor(guidelines, scriptIdentifier) {
this.guidelines = guidelines;
this.scriptIdentifier = scriptIdentifier;
}
addRunButton(el) {
const btn = document.createElement('button');
btn.textContent = 'Run';
btn.style.marginLeft = '5px';
@alexandrosm
alexandrosm / gist:8751262
Last active August 29, 2015 13:55
Card guessing strategy
###
During a recent flight with Eva, we were playing with cards to
relieve the boredom. Such boredom that we ended up guessing "red or black"
off a deck of cards, trying to see how many we could guess right in
a pack of 52. Without state, you expect to come in somewhere around 26.
Naturally I started thinking what a better strategy would be, so I figured
remembering how many red and black cards have come out so far would help
make better choices. So the strategy was simple: choose what has come out
@alexandrosm
alexandrosm / gist:8255011
Last active January 2, 2016 05:09
A lazy bacon.js recursive stream engine
define ['angular', 'bacon', 'lodash'], (angular, bacon, _) ->
($parse, ngUrlBind) ->
# StreamEngine is a generic stream generation and caching
# library that is dependent on bacon.js only. It takes
# as argument a streamSource function which takes the
# StreamEngine instance, source name, and source params
# as arguments and returns a bacon stream.
class StreamEngine
constructor: (streamSource) ->
@streamSource = streamSource.bind(null, this)
@alexandrosm
alexandrosm / gist:8204709
Created January 1, 2014 03:21
My solution to the alphabet code golf challenge.
match = [
'aerate aerate arrest errant serene tanner testes'
'aerate assent assent assert rester retest tenant'
'aerate assert rearer renter resent serene teaser'
'aerate easter easter tenant tester testes tsetse'
'arrest arrest easter entree errant resent senate'
'assent assess assets estate resent staree teaser'
'assert astern renter rerent resent staree street'
'assert enseat entree errata rennet teaser tsetse'
'assert rennet renter reseat rester serene tenant'
test