Skip to content

Instantly share code, notes, and snippets.

@maxwofford
maxwofford / gist:1654a998dd59148af68a
Created September 21, 2014 22:40
Replace key words in a file
# Replaces words in input.txt
# Takes arguments in the format foo='bar'
input = File.open('input.txt', "w")
ARGV.each do |i|
variable_name = i.to_s.split('=')[0]
contents = .to_s.split('=')[1]
input.gsub(variable_name, contents)
end
alert('hello');

It is a well-known fact that behind every good comet is a UFO. These UFOs often come to collect loyal supporters from here on Earth. Unfortunately, they only have room to pick up one group of followers on each trip. They do, however, let the groups know ahead of time which will be picked up for each comet by a clever scheme: they pick a name for the comet which, along with the name of the group, can be used to determine if it is a particular group's turn to go (who do you think names the comets?). The details of the matching scheme are given below; your job is to write a program which takes the names of a group and a comet and then determines whether the group should go with the UFO behind that comet.

Both the name of the group and the name of the comet are converted into a number in the following manner: the final number is just the product of all the letters in the name, where "A" is 1 and "Z" is 26. For instance, the group "USACO" would be 21 * 19 * 1 * 3 * 15 = 17955. If the group's number mod 47 is the

@maxwofford
maxwofford / appearin-scraper
Created October 31, 2014 08:02
A quick script to scrape the generated chatroom-name suggestions on appear.in
var adjectives = [];
var nouns = [];
function refresh() {
document.getElementsByClassName('refresh-button')[0].click();
}
function collectOutput() {
output = document.getElementById('room-namer').placeholder.split('-');
adjectives.push(output[0]);
/*! @license Firebase v2.0.5 - License: https://www.firebase.com/terms/terms-of-service.html */ (function() {var h,aa=this;function n(a){return void 0!==a}function ba(){}function ca(a){a.Qb=function(){return a.ef?a.ef:a.ef=new a}}
function da(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function ea(a){return"array"==da(a)}function fa(a){var b=da(a);return"array"==b||"object"==b&&"number"==typeof a.length}function p(a){return"string"==typeof a}function ga(a){return"
//Accepts inputs like: {lat:0,lng:0},{lat:15.623,lng:-23.421}
function getDistanceFromLatLonInKm(coords1, coords2) {
var R = 6371; // Radius of the earth in km
var dLat = deg2rad(coords2.lat-coords1.lat); // deg2rad below
var dLon = deg2rad(coords1.lng-coords2.lng);
var a =
Math.sin(dLat/2) * Math.sin(dLat/2) +
Math.cos(deg2rad(coords1.lat)) * Math.cos(deg2rad(coords2.lat)) *
Math.sin(dLon/2) * Math.sin(dLon/2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
@maxwofford
maxwofford / doc.md
Last active August 29, 2015 14:23 — forked from jonleung/doc.md
Maestro Documentation (c2w2d2)

###sendSms Send a text message to any phone number

maestro.Twilio.sendSms("484-555-5555", "Yo, what's up?");
//=> Send an text message to the phone  "484-555-5555" with the message "Yo, what's up?"

maestro.Twilio.sendSms("415-555-5555", "What's your order?");
//=> Send an text message to the phone "415-555-5555" with the message "What's your order?"
TIME_IN_MILLISECONDS=$(curl -s -u $TOGGL_TOKEN:api_token -X GET "https://toggl.com/reports/api/v2/summary/[email protected]&since=$(date +%Y-%m-%d -d '7 days ago')&workspace_id=$TOGGL_WORKSPACE_ID&project_id=$TOGGL_PROJECT_ID" | jq '.data[0].time')
echo $(($TIME_IN_MILLISECONDS / 3600000))
  • Packrat authentication flow should be reworked
  • Packrat attendance should be visible on feedback forms
  • Issues carried over
    • IRC <> Slack integration
    • Markcop refactor
    • Extra Markcop checks (ex. double newlines)

<2015-10-26 Mon>Planning meeting

Topics to bring up

  • Dockerize MarkCop
  • Select 3 clubs for focusing on feedback
    • These clubs will read over hackclub/hackclub#396
    • The clubs will work 1-on-1 with a core team member from Hack Camp to implement the feedback form system that was used.
  • Select 3 clubs for focusing on case studies
    • These clubs will work 1-on-1 with a core team member to submit a case study
    • The club can submit their case study through any medium (ex. Google Docs),