Skip to content

Instantly share code, notes, and snippets.

View dethe's full-sized avatar

Dethe Elza dethe

View GitHub Profile
@dethe
dethe / trails.js
Last active December 10, 2015 05:08
Slightly more complex Waterbear example using the rectangle sprites
var global = new Global();
(function(){
var local = new Local();
local.canvas = document.createElement("canvas");
local.canvas.setAttribute("width", global.stage_width);
local.canvas.setAttribute("height", global.stage_height);
global.stage.appendChild(local.canvas);
local.ctx = local.canvas.getContext("2d");
local.ctx.textAlign = "center";
var main = function(){
@dethe
dethe / coldata3.js
Last active December 14, 2015 22:09
var visualizations = {};
var data = {
"format": "CollusionSaveFile",
"version": "1.0",
"token": "{0ccd56d1-2f59-2142-8f72-e4d12dd64769}",
"connections": [
[
"lanistaads.com",
"rubiconproject.com",
1362156908018,
@dethe
dethe / random_circles..js
Last active December 18, 2015 07:28
New examples for Waterbear
local.count_201 = 0;
(function() {
setInterval(function() {
local.count_201++;
var point_202 = {
x: randint(0, global.stage_width),
y: randint(0, global.stage_height)
};
var radius_202 = 30;
var color_202 = "rgb(" + randint(0, 255) + "," + randint(0, 255) + "," + randint(0, 255) + ")";
{
"title": "Blacklight Worms",
"description": "Nice, but simple, use of sprites",
"date": 1371022449674,
"waterbearVersion": "2.0",
"blocks": [
{
"blocktype": "context",
"group": "scripts_workspace",
"id": "c7540554-a5d3-4dbf-bc62-f948b68b0d65",
@dethe
dethe / square.html
Created September 1, 2013 19:40
HTML Blue Square
<html>
<style>
.square{
width: 50px;
height: 50px;
background-color: blue;
</style>
<div class="square"></div>
</html>
var global = new Global();
(function(){
var local = new Local();
local.canvas = document.createElement("canvas");
local.canvas.setAttribute("width", global.stage_width);
local.canvas.setAttribute("height", global.stage_height);
global.stage.appendChild(local.canvas);
local.ctx = local.canvas.getContext("2d");
local.ctx.textAlign = "center";
var main = function(){
@dethe
dethe / gist:6945741
Created October 12, 2013 04:11
Mozilla limerick
A browser that came from Mozilla
Let me download so fast it was killa
With standards so fine
The whole web felt like mine
So I built some apps with no filla
@dethe
dethe / gist:7224448
Created October 29, 2013 23:17
Rough heuristic for determining whether a site was loaded by the user (first party vs. third party)
Heuristic for determining first party-ness
1. Does the request have a referrer?
2. Ignore requests that cannot be associated with a window (tab)
3. Is this request part of resolving the page (not Ajax)?
4. Are we able to resolve a host domain for referrer and tab URIs?
5. Are they the same?
6. Are they *not* 'about:blank'?
7. Ignore requests that come from within the add-on
8. Ignore requests that don't have a valid target or source
[
{"value":"950","label":"Global pharma market","description":"Global drugs market","source_name":"Forbes","source_link":"http://www.forbes.com/sites/matthewherper/2012/07/12/the-global-drug-market-will-swell-to-1-2-trillion-while-big-pharma-treads-water/"},
{"value":"901","label":"US budget deficit","description":"2013","source_name":"BBC News","source_link":"http://www.bbc.co.uk/news/world-us-canada-17014744"},
{"value":"89.8","label":"China","description":"China defence, 2011","source_name":"IISS","source_link":"http://www.iiss.org/publications/military-balance/the-military-balance-2012/press-statement/figure-comparative-defence-statistics/"},
{"value":"740","label":"Tobacco","description":"Global tobacco industry revenue, 2011","source_name":"Euromonitor","source_link":"http://blog.euromonitor.com/2012/06/new-tobacco-research-what-is-it-telling-us.html"},
{"value":"739.3","label":"US","description":"US defence, 2011","source_name":"IISS","source_link":"http://www.iiss.org/publications/military-balance/the
@dethe
dethe / waterbear.md
Last active December 29, 2015 12:29
Waterbear Project Description

Waterbear Project Description

Waterbear (http://waterbearlang.com/) is a toolkit for creating visual block-based programming languages for the web. Its blocks are inspired by Scratch (http://scratch.mit.edu/), but where Scratch is a full-fledged language, Waterbear is a family of languages and the tool for making them. Waterbear has been used to create visual languages which produce code for Javascript, Java, Arduino, Minecraft, and Processing. Where the code can be compiled and run in the browser it has capabilities for doing that safely.

Waterbear is primarily a learning environment where coding can be guided without having to worry about syntax errors. The goal is for it to be useful for casual programming by non-programmers in a variety of domains. We still have a ways to go before it is easy and intuitive to start coding with Waterbear, especially in guiding new users through their first scripts.

Overview

There are several components to Waterbear