Skip to content

Instantly share code, notes, and snippets.

View nadar71's full-sized avatar
🏠
Working from home

Simone Mapelli nadar71

🏠
Working from home
View GitHub Profile

FWIW: I (@Rondy) am not the author of the content presented here, which is an outline from Edmond Lau's book. I've just copy-pasted it from somewhere and saved as a personal gist, before it got popular on newsnews.ycombinator.com. I don't remember where exactly the original source is from and neither could find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

//In local.properties
tmdb_api_key = "xxxxxxxxxxxxxxxxxxxxxxxxxx"
//In build.gradle (Module: app)
buildTypes.each {
Properties properties = new Properties()
properties.load(project.rootProject.file("local.properties").newDataInputStream())
def tmdbApiKey = properties.getProperty("tmdb_api_key", "")
it.buildConfigField 'String', "TMDB_API_KEY", tmdbApiKey
@nadar71
nadar71 / banner.lua
Created February 4, 2017 15:53 — forked from revmob-sdk/banner.lua
RevMob Corona SDK
-- You may add this code in the main.lua file
require 'revmob'
local REVMOB_IDS = { ["Android"] = "Android App Id", ["iPhone OS"] = "IPhone OS App Id" }
RevMob.startSession(REVMOB_IDS)
local banner = RevMob.createBanner({x = display.contentWidth / 2, y = display.contentHeight - 20, width = 300, height = 40 })
-- You can also register listeners for Ad events:
revmobListener = function (event)
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,
@nadar71
nadar71 / line_intersection.lua
Created January 26, 2017 13:34 — forked from CoronaSDK/line_intersection.lua
Intersection of 2 lines for a Corona SDK Application
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
@nadar71
nadar71 / corona-custom.lua
Created January 26, 2017 13:33 — forked from PeterDwyer/corona-custom.lua
Texturepacker template for Corona to add support for sequencedata, based on the folder structure.
-- 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 %}
@nadar71
nadar71 / coronasdk-rating.lua
Created January 26, 2017 13:32 — forked from cjanis/coronasdk-rating.lua
Corona SDK Rating Prompt
-- 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
@nadar71
nadar71 / unzip_folder.lua
Created January 26, 2017 13:32 — forked from peter-mach/unzip_folder.lua
Unzipping the compressed folder with CoronaSDK zip plugin
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,
@nadar71
nadar71 / FuncDelegate.lua
Created January 26, 2017 13:29 — forked from erinlin/FuncDelegate.lua
[CoronaSDK/Lua] Function Delegate
-------------------------------------
-- function delegate
-- Author: Erin Lin
-- www.erinylin.com
-- 簡易模擬 C# delegate
-- licensed under the MIT license.
-- 2015, 02
-------------------------------------
--[[
Usage1:
@nadar71
nadar71 / circlelib.lua
Created January 26, 2017 12:19 — forked from HoraceBury/circlelib.lua
Create a portion of a fill or unfilled circle as a polygon and move it by it's circle-centre. Requires image: http://content.screencast.com/users/HoraceBury/folders/Default/media/18ea951e-71a1-44f4-a148-f2109a1c9059/brush2.png Download full solution: https://www.dropbox.com/s/8472upw9w2cwkwi/CircleLib.2015-12-02.001.zip?dl=0
-- circle lib
require("mathlib")
display.setDefault( "isAnchorClamped", false )
local min, max = -10000000000000, 10000000000000
local cache = {}
local circlelib = {}