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
local widget = require "widget" | |
local scroller = widget.newScrollView{ | |
width = 320, | |
height = 480, | |
scrollWidth = 700, | |
scrollHeight = 1000 | |
} | |
local obj = display.newImage( "myobject.png" ) | |
obj.x = 400 |
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
--[[ | |
== Example use == | |
... | |
]] | |
--== Built in functions | |
local assert = assert | |
local error = error | |
local pairs = pairs | |
local ipairs = ipairs |
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
--[[ | |
== Example use == | |
local Deferred = require( 'lib.deferred' ) | |
local unitOfProcessing = function( aDefer ) | |
local closure = function() aDefer:resolve( "hi there" ) end | |
timer.performWithDelay( 2000, closure ) | |
end | |
defer = Deferred.new( unitOfProcessing ) |
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
#### View the change history of a file #### | |
gitk [filename] | |
#### How to grep in the git history #### | |
git grep <regexp> $(git rev-list --all) | |
#### Changing the message on the last commit | |
git commit --amend -m "New 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
function print_r ( t ) | |
local print_r_cache={} | |
local function sub_print_r(t,indent) | |
if ( print_r_cache[ tostring(t) ] ) then | |
print( indent .. "*" .. tostring(t) ) | |
else | |
print_r_cache[ tostring(t) ]=true | |
if (type(t)=="table") then | |
for pos,val in pairs(t) do | |
if (type(val)=="table") 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
// Get version of cakephp | |
print( "Version: " . Configure::version() ); |
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
local t = {} | |
local mt = { x = 5 } | |
setmetatable( t, { __index = mt } ) | |
-- No t.x so metatable referenced | |
print( 1, t.x ) --> 5 | |
-- Add t.x (masking mt.x) | |
t.x = 4 | |
print( 2, t.x ) --> 4 |
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
local M = { | |
__index = _G, | |
__newindex = function( t, k, v ) | |
if rawget( _G, k ) ~= nil then | |
print( string.format( "Setting key '%s', on table %s masks a value in _G!!", tostring( k ), tostring( t ) ) ) | |
error() | |
else | |
rawset( t, k, v ) | |
end |
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
///// View controller ///// | |
#include "CGCustomPropertyLayer.h" | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
_layer = [CGCustomPropertyLayer new]; | |
[self.customLayerView.layer addSublayer:_layer]; | |
_layer.bounds = self.customLayerView.bounds; |
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
/// An object that has some tear-down logic | |
public protocol Disposable { | |
func dispose() | |
} | |
/// An event provides a mechanism for raising notifications, together with some | |
/// associated data. Multiple function handlers can be added, with each being invoked, | |
/// with the event data, when the event is raised. | |
public class Event<T> { |
OlderNewer