Skip to content

Instantly share code, notes, and snippets.

View AaronO's full-sized avatar

Aaron O'Mullan AaronO

View GitHub Profile
@AaronO
AaronO / GameScene.swift
Created December 4, 2022 00:21
GPT-Pong's code, created by ChatGPT, fixed by AaronO
import SpriteKit
import AVFoundation
class GameScene: SKScene {
// Create a ball node
let ball = SKShapeNode(circleOfRadius: 10)
// Create player paddles
let player1 = SKShapeNode(rectOf: CGSize(width: 10, height: 50))
let player2 = SKShapeNode(rectOf: CGSize(width: 10, height: 50))
@AaronO
AaronO / yoyo.js
Last active August 1, 2021 03:33
addEventListener("fetch", (event) => {
const response = new Response("🦕 are back !", {
headers: { "content-type": "text/plain; charset=UTF-8" },
});
event.respondWith(response);
});
@AaronO
AaronO / SprialMatrices.js
Last active August 2, 2017 17:53
Turn a 2d matrix into a flat array, of values in "clockwise order"
////
// Example (square) matrices
////
// 1x1
const M1 = [
[ 4 ],
];
const M2 = [
@AaronO
AaronO / symlink2hardlink.sh
Created July 6, 2016 20:12
Turns all symlinks in a folder into hardlinks
package main
import (
"fmt"
"os"
"github.com/fsouza/go-dockerclient"
)
func main() {
# hash returns a string representation of a function's arguments
# so that we can use that as a key
def hash(args):
return ":".join(map(str, args))
def memoize(fn):
cache = {}
def memoized_fn(*args):
hashed = hash(args)
if hashed in cache:
@AaronO
AaronO / git-clean-branches.sh
Created September 1, 2015 13:07
A small utility script that remove merged branches it ignores current branch, master and gh-pages for security
#!/bin/sh
git branch --merged | grep -v "*" | grep -v master | grep -v gh-pages | xargs git branch -d
@AaronO
AaronO / book.json
Created November 25, 2014 12:59
GitBook book.json with no sharing
{
"links": {
"sharing": {
"all": false
}
}
}
@AaronO
AaronO / parseDot.js
Created June 19, 2014 22:39
Parse semvers, chapter levels, and hierarchy's of numbers separated by dots to a javascript float
var _ = require('lodash');
var testNumbers = [
'0',
'0.1',
'0.2',
'1',
'1.4',
'1.9.4',
'1.11.4',
@AaronO
AaronO / mongodb-error-result.json
Last active August 29, 2015 14:01
MongoDB result object that has issues being parsed by the mongodb NodeJs driver. Response from mongod v2.5.3
{
"ok": false,
"errCode": 11000,
"errMsg": "E11000 duplicate key error index: gitbook.reviews.$book_1_author_1 dup key: { : ObjectId('536d14de82d0c0b66d183dee'), : ObjectId('536d144282d0c0b66d183ded')",
"n": 0
}