Skip to content

Instantly share code, notes, and snippets.

View cjanis's full-sized avatar

Craig Janis cjanis

View GitHub Profile
@cjanis
cjanis / blackjack.py
Created May 8, 2018 03:24
A simple blackjack game built with Python
## initiate game
print(
'\n' * 100 +
'#' * 16 +
'\n\nSIMPLE BLACKJACK' +
'\nby Craig Janis\n' +
'\nOverview: You start with two cards\nand decide whether to "hit" (ask\nfor another card) or "stand" (end\nyour turn with the cards you\nalready have). The dealer starts\nwith one card visible and one\ncard face down, and after your\nturn, the dealer will have a\nchance to hit or stand. You win\nif you end the game with more\npoints the dealer, but fewer\nthan 21 points. If you go over 21\npoints, that\'s called a "bust".\nTies go to the Dealer.\n\n' +
'#' * 16
)
@cjanis
cjanis / gist:3908053
Created October 17, 2012 20:44 — forked from kylebarrow/example.html
Prevent internal links in iOS standalone web apps from opening in Mobile Safari
if (window.navigator.standalone) {
var local = document.domain;
$('a').click(function() {
var a = $(this).attr('href');
if ( a.match('http://' + local) || a.match('http://www.' + local) ){
event.preventDefault();
document.location.href = a;
}
});
}
@cjanis
cjanis / coronasdk-iap.lua
Created November 28, 2012 06:14
Corona SDK: IAP
-- iap results
function iapTransaction(event)
if (event.transaction.state == "purchased") or (event.transaction.state == "restored") then
if (event.transaction.productIdentifier == "playmaticBalloons") then
data.iap.iapBalloons = "yes"
iconBalloonsPrice.alpha = 0
end
writeData()
elseif (event.transaction.state == "cancelled") then
elseif (event.transaction.state == "failed") then