Skip to content

Instantly share code, notes, and snippets.

@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) {
@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 / 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 / gulp-bundle-assets ASP.NET 4.5
Created March 10, 2016 19:19
A controller in ASP.NET 4.5 that returns a bundle config file generated by the gulp-bundle-assets package.
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using System.IO;
using System.Web.Mvc;
namespace DurandalTest.Controllers {
public class DurandalController : Controller {
public ActionResult Index() {
(function (tip) {
var i = tip;
var delayInMilliseconds = 1000;
for (i = i; 0 < i; i--) {
setTimeout(function () {
$('#id_tip_amount').val(1);
$('#id_tip_message').click();
}, i*delayInMilliseconds);
}
@AndrewCraswell
AndrewCraswell / OneWeekAutoShare.js
Created July 19, 2017 19:58
Script to automatically share a OneWeek hackathon project. Each share is delayed by 50ms to not overload the server causing a crash. To modify the number of times shared, edit the number on line 14. Paste the script into a browser's developer console to execute.
(function (shares) {
var i = shares;
var delayInMilliseconds = 50;
var shareBtn = angular.element('.share-button > a');
shareBtn.attr('href', 'javascript:void(0);');
for (i = i; 0 < i; i--) {
setTimeout(function () {
shareBtn.click();
(function (plays) {
var i = plays;
var delayInMilliseconds = 5500;
var playBtn = angular.element('.vjs-play-control');
for (i = i; 0 < i; i--) {
setTimeout(function () {
playBtn.click();
console.info('Play successful!');
setTimeout(function () {
@font-face {
font-family: SegoeUI;
src:
local("Segoe UI Light"),
url(//c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.woff2) format("woff2"),
url(//c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.woff) format("woff"),
url(//c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.ttf) format("truetype");
font-weight: 100;
}
{"completed":[{"id":"ddb2fa2b-c0c8-44e1-9f3a-3e0c7b60c171","event_id":27271,"external_id":"sqUz22","order":10,"name":"Adeyemi Aladesawe","description":"Build your network","points":50,"enabled":true,"datetime_completed":"2018-09-18T16:49:38.204Z"},{"id":"b186c39c-a77b-4fa6-945b-fb2c7348590d","event_id":27271,"external_id":"XLsPB6","order":11,"name":"Amit Bhatia","description":"Build your network","points":50,"enabled":true,"datetime_completed":"2018-09-18T16:49:26.685Z"},{"id":"4e2aef49-ed4a-437f-91c1-f66c79266325","event_id":27271,"external_id":"UFUyPw","order":12,"name":"Andrew Craswell","description":"Build your network","points":50,"enabled":true,"datetime_completed":"2018-09-18T16:48:21.462Z"},{"id":"8d7d6700-ae36-4ccf-9615-3337732aa883","event_id":27271,"external_id":"9aQGrU","order":13,"name":"Avik Choudhury","description":"Build your network","points":50,"enabled":true,"datetime_completed":"2018-09-18T16:48:27.233Z"},{"id":"335a59e0-cb7f-4cee-9cb4-a0ec1969c5f8","event_id":27271,"external_id":"nVo25k",
["Adeyemi Aladesawe","Amit Bhatia","Andrew Craswell","Avik Choudhury","Andres Delgado","Anthony Dawson","Allie Ello","Andrew Gordon","Anca Huza","Angela Harris","Anne Marie Hagel","Andrew Nickels","Alex Payne","Angie Pazhavila","Anouk Pape","Alicia Redmond","Aaron Sheerin","Ayuna Vogel","Adina Vlaicu","Aditya Venneti","Amanda Wilson","Andrea Wanerstrand","Bill Anderson","Bre'Ana Deen","Bev Hess","Brooke Hudson","Brian Hinkelman","Benjamin Jiang","Bernadette Kelly","Benjamin Lin","Bill Noonan","Brandon Neeb","Bob Maher","BJ O'Hare","Beth Pan","Brad Joseph","Brian Moore","Brian Telnes","Bill West","Christopher Busch","Carolyn Clark","Christine Clacey","Cait Huntsman","Cindy Healy","Cheryl Hong","Chris Howd","Calla Jordan","Corissa Koopmans","Carolyn Lesser","Charl Lee-Pearce","Christopher Mingle","Caren Mallue Dool","Chandler Nunez","Cecilia Perez-Benitoa","Chris Sitzman","Cindy Staley","Chee Sing Chen","Chris Thompson","Chris Wells","Dan MacFetridge","Dana Bartley","Dave Lockwood","Dawn Porter","Dan Bond","Dan