Skip to content

Instantly share code, notes, and snippets.

View pamelafox's full-sized avatar

Pamela Fox pamelafox

View GitHub Profile
@pamelafox
pamelafox / gist:10879482
Created April 16, 2014 13:55
BabyHint.js - checkFunctionDecl
checkFunctionDecl: function(line, lineNumber) {
var errors = [];
var functions = line.match(/function\s+\w+/g);
_.each(functions, function(fun) {
var name = fun.split(/\s+/g)[1];
// I18N: Don't translate the '\" var %(name)s = function() {}; \"' part
var error = {
row: lineNumber,
column: line.indexOf(fun),
@pamelafox
pamelafox / loops_worker.js
Created April 17, 2014 07:28
Checking for infinite loop
/* global initProcessingStubs */
importScripts("processing-stubs.js?cachebust=" + (new Date()).toDateString());
self.onmessage = function(event) {
var data = event.data,
context = data.context,
code = "with(arguments[0]){\n" +
data.code +
"\nif (typeof draw !== 'undefined' && draw){draw();}}",
@pamelafox
pamelafox / localstore.js
Created June 6, 2014 00:35
LocalStore.js
/**
* LocalStore is a *super* simple abstraction around localStorage for easy
* get/set/delete. We may end up wanting something more powerful like
* BankersBox, but for now this is much lighter weight.
*
* If you ever need to completely wipe LocalStore for *all* users when,
* say, changing the format of data being cached, just bump up the "version"
* property below.
*/
window.LocalStore = {
@pamelafox
pamelafox / securitytest.js
Created July 16, 2014 23:34
Security test (prompt, open)
var externals;
var localStorage = (function() { return this.localStorage; })();
var prompt = (function() { return this.constructor.prototype.prompt.bind(this); })();
var wopen = (function() { return this.constructor.prototype.open.bind(this); })();
var prompt2 = (function() { return this.prompt.bind(this); })();
var wopen2 = (function() { return this.open.bind(this); })();
localStorage.knowsPass_ID7232115911023911 = "xzz";
println(localStorage.knowsPass_ID7232115911023911);
prompt("What is the password?");
@pamelafox
pamelafox / gist:c49504d8a0337cbf2f72
Created August 16, 2014 17:09
Getting line number of first anonymous eval in stack in chrome
Error.prepareStackTrace = function(error, structuredStackTrace) {
return structuredStackTrace;
};
var getNumberFromChromeTrace = function(stack) {
// find first eval
var evalSite = null;
for (var i = 0; i < stack.length; i++) {
if (stack[i].isEval()) {
evalSite = stack[i];
@pamelafox
pamelafox / gist:7813307f8177509fea73
Created September 15, 2014 21:06
Security hack for HTML
<html>
<body>
<style>
h1{
background-color: yellow;
}
h2{
background-color: lightblue;
}
</style>
@pamelafox
pamelafox / jeopardy.sql
Created April 29, 2015 20:20
Jeopardy Questions
CREATE TABLE jeopardy(
ID INTEGER NOT NULL PRIMARY KEY
, Show_Number INTEGER
, Air_Date TEXT
, Round TEXT
, Category TEXT
, Value TEXT
, Question TEXT
, Answer TEXT
);
@pamelafox
pamelafox / ka_avatars.sql
Created May 8, 2015 18:03
ka_avatars.sql
/*
Khan Academy Avatars:
This table contains all of Khan Academy's avatars, including their type and name, the requirements to unlock them, and their relative image URL.
Collected by:
https://www.khanacademy.org/profile/chopsor/
*/
CREATE TABLE avatars (
id INTEGER,
@pamelafox
pamelafox / human_organs.sql
Created May 8, 2015 18:24
human_organs.sql
/*
Top 10 organs in the human body, by weight
Adapted from: https://propelsteps.wordpress.com/2014/10/12/know-top-10-largest-organs-of-the-human-body/
Collected by: https://www.khanacademy.org/profile/errorbuddy/
*/
CREATE TABLE organs (id INTEGER PRIMARY KEY,
name TEXT,
weight INTEGER,
important_functions TEXT,
@pamelafox
pamelafox / Completely Static App
Created January 11, 2011 18:20
For App Engine
application: oliverfoxmurals
version: 1
runtime: python
api_version: 1
handlers:
- url: /
static_files: static/index.html
upload: static/index.html