This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- ios standalone web app --> | |
<meta name="apple-mobile-web-app-capable" content="yes"> | |
<!-- ios status bar appearance, options: black, black-translucent --> | |
<meta name="apple-mobile-web-app-status-bar-style" content="black"> | |
<!-- ios icon, just one size because ios will scale it, remove "-precomposed" if you want ios to add effects --> | |
<link href="[email protected]" sizes="144x144" rel="apple-touch-icon-precomposed"> | |
<!-- ios startup images --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (window.navigator.standalone) { | |
var setLastUrl = function() { | |
localStorage['lastUrl'] = window.location; | |
} | |
if (sessionStorage['init']) { | |
setLastUrl(); | |
} else { | |
sessionStorage['init'] = true; | |
if (localStorage['lastUrl']) { | |
if (localStorage['lastUrl'] != window.location) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// this goes into your theme's functions.php file | |
function popularPosts($limit) { | |
global $wpdb; | |
$posts = $wpdb->get_results("SELECT * FROM wp_posts WHERE $wpdb->posts.post_status='publish' AND $wpdb->posts.post_type='post'"); | |
// get data for each post | |
$popular = array(); | |
foreach ($posts as $post) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--os.remove(system.pathForFile( "data.db", system.DocumentsDirectory)) | |
-- read data | |
function readData() | |
local path = system.pathForFile("data.db", system.DocumentsDirectory) | |
local file = io.open(path, "r") | |
if (file) then | |
data = json.decode(file:read("*a")) | |
else | |
file = io.open(path, "w") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- show rating prompt | |
local function ratingPrompt() | |
local function ask() | |
local function answer(event) | |
if ("clicked" == event.action) then | |
if (event.index == 1) then | |
system.openURL("http://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=440754678") | |
data.rated = "yes" | |
writeData() | |
elseif (event.index == 2) then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# turn on sudo | |
sudo su | |
# enter admin user password | |
# create the SACL for access to RADIUS | |
dseditgroup -q -o create -u <admin user> -n . com.apple.access_radius | |
# configure radiusd to log both successful and failed authentications | |
radiusconfig -setconfig auth yes | |
radiusconfig -setconfig auth_badpass yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create alphabet and digits dictionary | |
import string | |
alphabet_master = string.ascii_lowercase + string.digits + ' ' | |
alphabet_master = {a:(alphabet_master.index(a) + 1) for a in alphabet_master} | |
# the cipher | |
def cipher(direction,key,message): | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
calculate pi using the Nilakantha series up to 48 decimals of precision | |
Nilakantha series approximates pi, but is not as accurate as some other, more intensive methods | |
the most accurate predictions come with odd number decimal precision | |
'' | |
def calculate_pi(decimals): | |
# make the calculation |
OlderNewer