Skip to content

Instantly share code, notes, and snippets.

View mcongrove's full-sized avatar

Matthew Congrove mcongrove

View GitHub Profile
@mcongrove
mcongrove / sign_commits.md
Created April 5, 2020 23:57
Verify Unsigned Commits

Workaround to verify unsigned commits in github

All commits started from 8fd7b22 will be rebased with no changes except signing.

git rebase --exec 'git commit --amend --no-edit -n -S' -i 8fd7b22
git push --force

Source

@mcongrove
mcongrove / olympiad.md
Last active October 4, 2019 21:16
Pinpoint Olympiad Information

Player Nomination

For many of the events below, teams nominate 1 or 2 players to play on the team's behalf. No player may participate in more than 2 of these nominated events (i.e. you cannot have the same player participate in the basketball, air hockey and foosball).


Events

Round 1, Indoor

defineProperty("viewX", globalPropertyf("sim/graphics/view/view_x"))
defineProperty("viewY", globalPropertyf("sim/graphics/view/view_y"))
defineProperty("viewZ", globalPropertyf("sim/graphics/view/view_z"))
defineProperty("acfX", globalPropertyf("sim/flightmodel/position/local_x"))
defineProperty("acfY", globalPropertyf("sim/flightmodel/position/local_y"))
defineProperty("acfZ", globalPropertyf("sim/flightmodel/position/local_z"))
function cameraDistance()
local cX = (math.abs(get(viewX)) - math.abs(get(acfX)))
local cY = (math.abs(get(viewY)) - math.abs(get(acfY)))
function foo()
if (get(onGround)==1) then
if (get(doorOpen)>=1) then
if (get(engineRunning)==1) then
g = 250
else
g = 500
end
else if (get(viewExternal)==1) then
g = 750
<?php
/**
* Write a script that prints the numbers 1 through 100.
* However, if a number is divisible by 3 then print the word 'Fizz' instead, or the word 'Buzz' if divisible by 5.
* If the number is divisible by both 3 and 5, instead print 'FizzBuzz'.
*/
for($i = 1; $i <= 100; $i++)
{
@mcongrove
mcongrove / gist:1015435
Created June 8, 2011 21:22
getResponseCookies Regex
Test values:
cn1=cv1; Domain=something.org; Max-Age=89000000; Path=/eportal; HttpOnly, cn2=cv2; HttpOnly , cn3=cv3
cn1=cv1; Domain=something.what.org; Path=/eportal; HttpOnly, cn2=cv2; HttpOnly , cn3=cv3;
cn1=cv1; Domain=something.org; Max-Age=890000;,cn2=cv2, cn3=cv3
cn1=cv1; Domain=what.org; Expires=Fri, 21-Mar-2014 16:52:43 GMT; HttpOnly, cname2=cvalue2; HttpOnly
Expression:
([a-zA-Z0-9])+(?<!Domain|Path|Age|Expires)=([a-zA-Z0-9])+
@mcongrove
mcongrove / login.js
Created May 3, 2011 20:14
Simple login example
var login = {
authorized: false,
session_id: null,
init: function() {
// See if we have an existing sess_id
login.session_id = login.checkForSession();
// If not, open login window
if(!login.session_id) {
login.openLoginPage();
@mcongrove
mcongrove / HTML5_Audio_Duration.html
Created April 20, 2011 06:36
Retrieve the duration of an HTML5 audio element.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>HTML5 Audio Duration</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
var audio, duration;
window.onload = function() {
var element = document.createElement("audio");
@mcongrove
mcongrove / RedFlare.md
Created April 14, 2011 21:10
A description of the RedFlare service.

What is RedFlare?

RedFlare is an automated emergency contact notification system. It automatically contacts the people who love you in the event that you didn't get home when you should have.

Why do I need it?

Say for instance that you just moved to Boston, MA, and you want to go exploring the mountains just outside the city. Unfortunately you don't have many friends in town, so no one will notice if you've gone missing for quite some time. If the unthinkable happens and you've been pinned under a rock, broken an ankle or just gotten lost in an area without cell reception, you could be in serious trouble.

@mcongrove
mcongrove / TiFtp.js
Created April 11, 2011 22:02
An FTP wrapper library for Titanium Mobile.
var TiFtp = {
config: {
host: null,
port: 21,
path: null,
user: null,
password: null
},
init: function(_host, _path, _user, _password) {
if(!_host || !_path || !_user || !_password) {