This file contains hidden or 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
local widget = require("widget") | |
local function angleOf( ax, ay, bx, by, adjust, positive ) | |
local angle = math.atan2( by-ay, bx-ax ) * 180/math.pi | |
if (adjust) then | |
if (type(adjust) ~= "number") then adjust = -90 end | |
angle = angle - adjust | |
if (angle < -180) then angle=angle+360 end | |
if (angle > 180) then angle=angle-360 end |
This file contains hidden or 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
-- circle lib | |
require("mathlib") | |
display.setDefault( "isAnchorClamped", false ) | |
local min, max = -10000000000000, 10000000000000 | |
local cache = {} | |
local circlelib = {} |
This file contains hidden or 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
------------------------------------- | |
-- function delegate | |
-- Author: Erin Lin | |
-- www.erinylin.com | |
-- 簡易模擬 C# delegate | |
-- licensed under the MIT license. | |
-- 2015, 02 | |
------------------------------------- | |
--[[ | |
Usage1: |
This file contains hidden or 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
local zip = require 'plugin.zip' | |
local zipFileName = 'zippedFolder.zip' | |
local function unzipListener( event ) | |
print('unzipping complete') | |
end | |
local unzipOptions = { | |
zipFile = event.response.fileName, | |
zipBaseDir = system.TemporaryDirectory, |
This file contains hidden or 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 hidden or 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
-- created with TexturePacker (http://www.codeandweb.com/texturepacker) | |
-- | |
-- {{smartUpdateKey}} | |
-- | |
-- local sheetInfo = require("mysheet") | |
-- local myImageSheet = graphics.newImageSheet( "mysheet.png", sheetInfo:getSheet() ) | |
-- local sprite = display.newSprite( myImageSheet , {frames={sheetInfo:getFrameIndex("sprite")}} ) | |
-- | |
{% load filter %} |
This file contains hidden or 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
function intersection(p11,p12,p21,p22) | |
local Z = (p12.y-p11.y)*(p21.x-p22.x)-(p21.y-p22.y)*(p12.x-p11.x); | |
local Ca = (p12.y-p11.y)*(p21.x-p11.x)-(p21.y-p11.y)*(p12.x-p11.x); | |
local Cb = (p21.y-p11.y)*(p21.x-p22.x)-(p21.y-p22.y)*(p21.x-p11.x); | |
if Z == 0 and Ca == 0 and Cb == 0 then return nil end | |
if Z == 0 then return nil end |
This file contains hidden or 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
local targetDevice = ( system.getInfo( "model" ) ) | |
local isTall = ( "iPhone" == system.getInfo( "model" ) ) and ( display.pixelHeight > 960 ) | |
if isTall == false and targetDevice == "iPhone" then | |
application = | |
{ | |
content = | |
{ | |
width = 320, | |
height = 480, |
This file contains hidden or 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
public class MapLocationActivity extends AppCompatActivity | |
implements OnMapReadyCallback, | |
GoogleApiClient.ConnectionCallbacks, | |
GoogleApiClient.OnConnectionFailedListener, | |
LocationListener { | |
GoogleMap mGoogleMap; | |
SupportMapFragment mapFrag; | |
LocationRequest mLocationRequest; | |
GoogleApiClient mGoogleApiClient; |