Skip to content

Instantly share code, notes, and snippets.

View DanBradbury's full-sized avatar
:shipit:
Doing the work

Dan Bradbury DanBradbury

:shipit:
Doing the work
View GitHub Profile

This is old news by now for most but I had quite a bit of fun implementing it for myself and figured I'd share my code and some learnings that came along with it. The basic idea is to use canvas to render an uploaded image and then utilize the toDataURL method on canvas to retrieve a Base64 encoded version of the image. In the example included here we will just direct link to the newly scaled image but you could imagine that we kick off an ajax request and actually process the image (in PHP base64_decode FTW). Without any more tangential delay let's take a look at the code.

<input type="file" accept="image/*" id="imageFile" />
<table>
	<tr>
		<td>Width: <input type="text" id="width" value="200" style="width:30; margin-left: 20px;" /></td>
	</tr>
	<tr>
		<td>Height: <input type="text" id="height" value="200" style="width:30; margin-left: 20px;" /></td>
@DanBradbury
DanBradbury / spec_helper.rb
Last active February 12, 2016 08:13
Replacing simplecov
# add to the top of your spec_helper.rb
require 'yardcov'
YardCov.start
# require files
# ...
Rspec.configure do |config|
# ...
config.after(:suite) do
YardCov.report_results
@DanBradbury
DanBradbury / 0_reuse_code.js
Created September 2, 2016 20:41
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
@DanBradbury
DanBradbury / googleFetch.rb
Created October 31, 2016 17:25
Autoemoji
#!/usr/bin/env ruby
require 'uri'
require 'net/https'
require 'nokogiri'
if ARGV.size != 1
puts "Usage: ruby googleFetch.rb SEARCH_VALUE"
exit
end
search_value = ARGV[0]
http://imgur.com/a/DGraO
http://imgur.com/a/mQGSz
http://imgur.com/a/SvszQ
http://imgur.com/a/zD7KT
http://imgur.com/a/6Vz5I
http://forums.unfiction.com/forums/viewtopic.php?t=40750
@DanBradbury
DanBradbury / amtrakconnect.html
Created March 7, 2017 03:00
Amtrakconnect.com
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Metas tag -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<title>AmtrakConnect - Welcome</title>
<link rel="stylesheet" type="text/css" href="css/siimple.css">
<link href="css/styles.css" rel="stylesheet" type="text/css">
import yaml,os, json
ENV_PREFIX = 'cc-api-service-beta-'
with open('serverless.yml') as f:
data = yaml.safe_load(f)
#print data['provider']['environment']
env_vars = {}
#env_string = "--environment Variables={first=1"
for env_var in data['provider']['environment'].keys():
@DanBradbury
DanBradbury / download_and_unzip.py
Last active November 16, 2018 07:43
Automate Bundle Download
import urllib, zipfile, os
from tqdm import tqdm
links = [
]
for link_location in tqdm(links):
urllib.urlretrieve(link_location, "temp.zip")
zip = zipfile.ZipFile("temp.zip")

Ludum Dare 43 Post Mortem

I'll do my best to keep all my disappointment out of this post but I am obviously a little upset that after X hours of work I didn't have a game to deliver. I think there are tons of things to take away from the entire experience even though technical tooling issues became too much.

What Ended Everything

I don't think it's fair to blame all the problems on a single extension but I will say that it was not smart on my part to try and use something I had never used (full cycle; dev -> deliverable .exe / HTML package).. I'm usually not the one to buy into the marketing hype but I was sold on the idea of having my draw functions be reloaded when I saved an object without having to recompile (was a huge save) without truly thinking about the potential consequences 3 days into the competition...

Not testing the tool (GMLive) adequately before jumping into a competition was a mistake.. should have / could have used a day before the Jam to create a small project that I had tested the