Skip to content

Instantly share code, notes, and snippets.

View skyblue's full-sized avatar
🎯
Focusing

Skyblue skyblue

🎯
Focusing
View GitHub Profile
@spilliams
spilliams / 1_iOS_bootstrap.md
Last active December 14, 2015 17:09
steps for bootstrapping an iOS project

#Bootstrapping An iOS App

Note: If you're bootstrapping a static lib project, read this gist instead.

##Project Setup

  1. New xcode project (including save to directory).
  2. Set devices and iOS target
  3. decide if you're going to use Autolayout (set in the Storyboard > File inspector > Interface Builder Document section)
  4. Create Constants.h, and #import "Constants.h" in the PCH
@naholyr
naholyr / _service.md
Created December 13, 2012 09:39
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@cjanis
cjanis / coronasdk-rating.lua
Created November 28, 2012 06:35
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
@return1
return1 / trim_enabler.txt
Last active August 1, 2025 02:11
TRIM Enabler for OS X Yosemite 10.10.3
#
# UPDATE for 10.10.4+: please consider this patch obsolete, as apple provides a tool called "trimforce" to enable trim support for 3rd party SSDs
# just run "sudo trimforce enable" to activate the trim support from now on!
#
# Original version by Grant Parnell is offline (http://digitaldj.net/2011/07/21/trim-enabler-for-lion/)
# Update July 2014: no longer offline, see https://digitaldj.net/blog/2011/11/17/trim-enabler-for-os-x-lion-mountain-lion-mavericks/
#
# Looks for "Apple" string in HD kext, changes it to a wildcard match for anything
#
# Alternative to http://www.groths.org/trim-enabler-3-0-released/
@mattmccray
mattmccray / Makefile
Created October 19, 2012 04:15
Simple comparison of several compile-to-javascript languages, including: CoffeeScript, Dart, Haxe, and TypeScript.
.PHONY: compile
time=/usr/bin/time
compile: dart typescript coffeescript haxe jsx
dart:
$(time) dart2js -ooutput/dart.js source/simple.dart
typescript:
@sekati
sekati / xcode-build-bump.sh
Created July 24, 2012 20:44
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@catwell
catwell / messagepack-in-lua.md
Created June 22, 2012 08:21
The state of MessagePack in Lua

The state of MessagePack in Lua

The new MessagePack website says that MessagePack for Lua is "coming soon". I thought it would be a good idea to make a quick recap on the state of MessagePack in Lua.

The historical implementation of MessagePack is mplua by Nobuyuki Kubota. It is the implementation linked from the MessagePack wiki. However, it is rather old (no updates for two years) and not very fast.

A bit less than a year ago I had to use MessagePack in LuaJIT and I wrote a FFI-based binding on the official C interface of MessagePack. I had to include a small C library that had to be compiled to wrap inline functions in the interface.

I did not like that design and it had performance issues in real use cases, mostly because I had to use calls that break the JIT mode in LuaJIT. I decided to re-implement MessagePack directly in LuaJIT with no calls to any

@guileen
guileen / config.js
Created June 15, 2012 10:28
bad style?
// ------------
// config.js
module.exports = {mongo: 'mongo://localhost/test'};
// -----------
// index.js
var mongoskin = require('mongoskin');
@raptium
raptium / gist:2848464
Created June 1, 2012 03:28
敏感词列表
@jboner
jboner / latency.txt
Last active November 17, 2025 14:46
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD