Skip to content

Instantly share code, notes, and snippets.

View ambethia's full-sized avatar
🐼
PANDAS!

Jason L Perry ambethia

🐼
PANDAS!
View GitHub Profile
@ambethia
ambethia / memory.txt
Last active December 11, 2016 20:50
Pseudocode to describe a game of memory.
faces = [🤖, 🐢, 🐼, 🐙, 👾, 👹, 🐢, 👾, 😱, 🤖, 🐲, 🐙, 😱, 👹, 🐼, 🐲]
matched = []
picks = []
choose(positionOfCard) function:
If the number of picks is 2:
Do nothing (stop the player from choosing 3 cards).
Add positionOfCard to picks.
If the number of picks is now 2:
check()
[
{
"name": "Finn the Human",
"image": "http://i.cdn.turner.com/v5cache/CARTOON/site/Images/i18/propd_at_char_finn.png",
"details": "Finn is a silly kid who wants to become a great hero one day. He might not look too tough, but if there's evil around, he'll slay it. That's his deal."
},
{
"name": "Jake the Dog",
"image": "http://i.cdn.turner.com/v5cache/CARTOON/site/Images/i18/propd_at_char_jake.png",
"details": "Finn's best friend is a wise, old dog with a big heart. Jake has the magical ability to stretch and grow. When evil's not running amok, he plays viola with his girlfriend, Lady Rainicorn."
@ambethia
ambethia / gif.sh
Created November 7, 2016 00:51
Using Imagemagick to make an animated gif from a sequence of png images
convert -delay 10 -resize 800x600 -loop 0 *.png animation.gif
var blob = new Blob([csvString]);
var a = window.document.createElement("a");
a.href = window.URL.createObjectURL(blob, {type: "text/plain"});
a.download = "filename.csv";
// document.body.appendChild(a);
// a.click();
// document.body.removeChild(a);
var actors = new Array<Int>();
var currentDepth = 0;
for(depth in frame.actors.keys()) {
var actor = frame.actors[depth].shape;
depth < currentDepth ? actors.unshift(actor) : actors.push(actor);
}
@ambethia
ambethia / keyframes.rb
Created February 28, 2016 23:16
Ruby script to generate CSS animation keyframes for a rotating font icon who's text-shadow stays at the same angle
L = 0.15
S = 8
(S+1).times do |i|
time = (100.0 / S) * i
angle = ((360 / S) * i)
theta = ((angle % 360) * -1) * Math::PI / 180
x = L * Math.cos(theta) - L * Math.sin(theta)
y = L * Math.sin(theta) + L * Math.cos(theta)
@ambethia
ambethia / index.js
Created January 18, 2016 05:03
A not-fully-working attempt at detecting Hearthstone events by packet sniffing.
import pcap from 'pcap';
import ProtoBuf from 'protobufjs';
import ByteBuffer from 'bytebuffer';
import glob from 'glob';
const protoPath = __dirname + "/../vendor/hs-proto";
let root = {};
let decoders = {};
@ambethia
ambethia / 0_reuse_code.js
Last active August 27, 2015 19:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
const MIN = 1
const MAX = 1000
let guess, upper, lower, tries
const startGame = () => {
updateGame()
document.querySelector('#intro').style.display = 'none'
document.querySelector('#game').style.display = 'block'
}
#!/usr/bin/env ruby
require 'net/http'
require 'json'
require 'cgi'
class Card
SUITS = [
"Diamonds",
"Hearts",