Skip to content

Instantly share code, notes, and snippets.

@AndrewCraswell
AndrewCraswell / PredictIt_NoBetProfitEstimator.js
Last active March 5, 2016 20:08
Function to calculate the return from betting "No" on all reasonable markets in a PredictIt.com Linked market type.
// Function to calculate the return from betting "No" on all reasonable markets in a PredictIt.com Linked market type.
// Execute by browsing to the linked market overview, and pasting function into the Developer Console window (F12)
(function () {
// Get the prices of each "No" option.
var noList = $('#contractListTable .sharesDown > .sharesDown').text().split('¢').filter(function (item) {
// Filter out options not currently traded, or costing more than $0.96.
return !(item === '' || item.indexOf('None') > -1 || item >= 97);
}).map(function (item, idx) {
return parseInt(item) / 100;
@AndrewCraswell
AndrewCraswell / ClassScheduleExporter.cs
Last active January 1, 2016 19:09
This is a namespace I wrote as part of the Bellevue College Class Schedule application in early 2013. The namespace creates an export feature allowing all programs and classes maintained in the database to be exported to a single text file. The file is formatted for Adobe InDesign. It is ultimately formatted and used for printing the school's pa…
// <copyright file="ClassScheduleExporter.cs" company="Bellevue College">
// Licensed under GNU General Public License, Version 3.0 (the "License"): You may copy,
// distribute and modify the software as long as you track changes/dates of in source files
// and keep modifications under GPL. You can distribute your application using a GPL library
// commercially, but you must also provide the source code.
//
// http://www.gnu.org/licenses/gpl.html
// </copyright>
namespace CTCClassSchedule.Common
@AndrewCraswell
AndrewCraswell / codeBot.js
Last active December 25, 2015 20:08
Simple bot for CoderClicker: http://coderclicker.meteor.com/ How to use: Paste the following into the JavaScript console in your browser and run it. To start the bot type: "CodeBot.start();" to stop it do: "CodeBot.stop();" (or just reload the page). This gist was fashioned from: https://gist.github.com/jeresig/6720127 and https://github.com/pat…
CodeBot = {
start: function() {
var self = this;
self.spendAll = function() {
var score = this.toFixed(Number(Meteor.users.findOne({_id:Meteor.userId()}).profile.score));
$(".details").append('<input type="button" id="' + score + '" class="buy btn span4">');
$("#" + score).click();
}
self.toFixed = function(x) {
if (Math.abs(x) < 1.0) {