Skip to content

Instantly share code, notes, and snippets.

View dabing1022's full-sized avatar
👨‍💻
Focusing

ChildhoodAndy dabing1022

👨‍💻
Focusing
View GitHub Profile
@lzubiaur
lzubiaur / notification.lua
Last active March 24, 2018 12:34
Lua Notification Center (cocos2dx)
--[[
Why this package?
Cocos2d-x CCNotificationCenter is limited to one lua function callback (observer) per target (CCObject).
This simple Lua script wraps CCNotificationCenter and allows code like:
addObserver(foo,'eventname')
addObserver(foo2,'eventname')
]]--
-- The NotificationCenter (nc) table
local nc = {
@dabing1022
dabing1022 / LuaCoroutine.lua
Created December 21, 2013 06:59
理解LUA协程
-- LUA协程
-- http://my.oschina.net/wangxuanyihaha/blog/186401
-- coroutine.create(f)
-- 函数参数[接受单个参数,这个参数为coroutine的主函数]
-- 函数返回值[返回一个thread对象]
-- 函数作用[创建一个新的协程,协程的主函数定义了该协程内的任务流程]
-- coroutine.resume(co, [, var1, ...])
@simlegate
simlegate / install.md
Last active January 20, 2022 03:41
搭建私有的gems仓库

分为步:

  • 同步gems mirror
    安装rubygems-mirror 原来的rubygems-mirror好像有问题,所以使用@huacnlee改过的gem
    按照README.md说明配置.mirrorrc

    # 国内最好用taobao的源,rubygems经常被墙
    ---
    - from: http://ruby.taobao.org
    to: /data/rubygems
ACTION
AD_HOC_CODE_SIGNING_ALLOWED
ALTERNATE_GROUP
ALTERNATE_MODE
ALTERNATE_OWNER
ALWAYS_SEARCH_USER_PATHS
ALWAYS_USE_SEPARATE_HEADERMAPS
APPLE_INTERNAL_DEVELOPER_DIR
APPLE_INTERNAL_DIR
APPLE_INTERNAL_DOCUMENTATION_DIR
@dabing1022
dabing1022 / Touch.m
Last active December 17, 2015 02:49
实现触摸
#pragma mark - touch delegate
- (CGPoint)locationFromTouch:(UITouch *)touch
{
CGPoint touchLocation = [touch locationInView:[touch view]];
return [[CCDirector sharedDirector]convertToGL:touchLocation];
}
- (BOOL)containsTouchLocation:(UITouch *)touch
{
CGRect selfRect = CGRectMake(self.position.x, self.position.y, self.contentSize.width, self.contentSize.height);
@adamgit
adamgit / .gitignore
Last active September 13, 2025 22:55
.gitignore file for Xcode4 / OS X Source projects
#########################
# .gitignore file for Xcode4 and Xcode5 Source projects
#
# Apple bugs, waiting for Apple to fix/respond:
#
# 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation?
#
# Version 2.6
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
@jxson
jxson / README.md
Created February 10, 2012 00:18
README.md template

Synopsis

At the top of the file there should be a short introduction and/ or overview that explains what the project is. This description should match descriptions added for package managers (Gemspec, package.json, etc.)

Code Example

Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.

Motivation

@kylefox
kylefox / color.m
Created January 27, 2012 17:45
Generate a random color (UIColor) in Objective-C
/*
Distributed under The MIT License:
http://opensource.org/licenses/mit-license.php
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
@gaspard
gaspard / gist:1636042
Created January 18, 2012 21:54
Simple Box2D demo with Lubyk
require 'lubyk'
-- Box2D bindings are not yet in published but code will look the same
-- (18.1.2012)
local function makeBody(x, y, r, hue)
-- Define the dynamic body. We set its position and call the body factory.
local bodyDef = b2.BodyDef()
bodyDef.type = b2.dynamicBody
bodyDef.position:Set(x, y)