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 / TiLoad.js
Created April 6, 2011 17:12
A loading screen that can be shown and hidden from anywhere within an application
var TiLoad = {
visible: false,
init: function(_properties) {
var options;
if(_properties && _properties.rotate) {
options = {
orientationModes: [
Titanium.UI.LANDSCAPE_LEFT,
Titanium.UI.LANDSCAPE_RIGHT,
@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

@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");
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
@mcongrove
mcongrove / TiDrop.js
Created April 1, 2011 22:13
A quick and simple example of how to do drag+drop in Titanium
var TiDrop = {
touching: false,
position: {
elementYStart: 0,
elementXStart: 0,
yStart: 0,
xStart: 0,
yCurrent: 0,
xCurrent: 0
},
<?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();