Skip to content

Instantly share code, notes, and snippets.

Pamela Fox pamelafox

Block or report user

Report or block pamelafox

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pamelafox
pamelafox / gist:10879482
Created Apr 16, 2014
BabyHint.js - checkFunctionDecl
View gist:10879482
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 Apr 17, 2014
Checking for infinite loop
View loops_worker.js
/* 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();}}",
View 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 Jul 16, 2014
Security test (prompt, open)
View securitytest.js
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 Aug 16, 2014
Getting line number of first anonymous eval in stack in chrome
View gist:c49504d8a0337cbf2f72
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];
View gist:7813307f8177509fea73
<html>
<body>
<style>
h1{
background-color: yellow;
}
h2{
background-color: lightblue;
}
</style>
@pamelafox
pamelafox / screenshot.js
Created Apr 10, 2015
Screenshot Bookmarklet
View screenshot.js
// How to add a bookmarklet to Chrome: https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=chrome%20bookmarklet
javascript:(function getScreenshot() {var openScreenshot = function(e) {window.open(e.originalEvent.data);}; $(window).unbind("message.getScreenshot", openScreenshot); $(window).bind("message.getScreenshot", openScreenshot); ScratchpadUI.liveEditor.postFrame({ screenshot: true, screenshotSize: 400 });})();
@pamelafox
pamelafox / jeopardy.sql
Created Apr 29, 2015
Jeopardy Questions
View jeopardy.sql
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
);
View 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,
View 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,
You can’t perform that action at this time.