Skip to content

Instantly share code, notes, and snippets.

@iAladdin
iAladdin / DicLog.AppleScript
Last active Feb 28, 2017
Dictionary Logger
View DicLog.AppleScript
# © McUsr/MacUser06 2012
on run {input, parameters}
set glossaryName to "DictLogger.txt"
set AutomatorIcon to (a reference to file ((path to applications folder as text) & "Automator.app:Contents:Resources:Automator.icns"))
# checks to see if the current selection contains anything valid
considering diacriticals
if first character of (input as text) is not in "abcdefghijklmnopqrstuvwxyz" then
tell application "System Events" to set appname to name of first process whose frontmost is true
using terms from application "Finder"
@iAladdin
iAladdin / PrettyLog.h
Created Nov 3, 2016
PrettyLog replace NSLog
View PrettyLog.h
#define pLog(fmt) prettyLog(fmt,[NSString stringWithFormat:@"%s:%d",__FILE__,__LINE__],__PRETTY_FUNCTION__)
NSString * lastFunction = nil;
NSString * lastLine = nil;
void prettyLog(NSString * string,NSString * fileline,const char * function){
NSString * currentFileLine = fileline;
NSString * currentFunction = [NSString stringWithFormat:@"%s",function];
@iAladdin
iAladdin / GAME_MASTER_v0_1.protobuf
Created Jul 17, 2016 — forked from anonymous/GAME_MASTER_v0_1.protobuf
Pokemon Go decoded GAME_MASTER protobuf file v0.1
View GAME_MASTER_v0_1.protobuf
Result: 1
Items {
TemplateId: "BADGE_BATTLE_ATTACK_WON"
Badge {
BadgeType: BADGE_BATTLE_ATTACK_WON
BadgeRanks: 4
Targets: "\nd\350\007"
}
}
Items {
@iAladdin
iAladdin / creator-debug-scripts.md
Last active Jun 2, 2016 — forked from jareguo/creator-debug-scripts.md
运行时 Creator 调试工具集
View creator-debug-scripts.md

在收藏夹中新增一个网页,将网址设为下面的其中一个源码。然后打开任一 Creator 页面,接着直接在收藏夹点击刚刚收藏的网址即可。

打印 Hierarchy

javascript:(function () {
    function visitNode (node, visitor) {
        visitor(node);
        var children = node._children;
 for (var i = 0; i < children.length; ++i) {
View .slate
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
# Resize Bindings
bind right:alt;ctrl resize +10% +0
bind left:alt;ctrl resize -10% +0
bind up:alt;ctrl resize +0 -10%
bind down:alt;ctrl resize +0 +10%
# bind right:ctrl;alt resize -10% +0 bottom-right
@iAladdin
iAladdin / TestflihtappDeployTeamcity.sh
Created Apr 23, 2012 — forked from JohannesRudolph/TestflihtappDeployTeamcity.sh
Builds and deploys an App to testflightapp.com. Integrates with Teamcity.
View TestflihtappDeployTeamcity.sh
#!/bin/bash
#
# testflightapp.com tokens
API_TOKEN="YOUR_API_TOKEN"
TEAM_TOKEN="YOUR_TEAM_TOKEN"
PRODUCT_NAME="RowMotion"
ARTEFACTS="$PWD/Artefacts"
@iAladdin
iAladdin / build.sh
Created Apr 23, 2012 — forked from jonah-williams/build.sh
Command line iOS project builds and over-the-air distribution
View build.sh
#!/bin/bash
# https://gist.github.com/949831
# http://blog.carbonfive.com/2011/05/04/automated-ad-hoc-builds-using-xcode-4/
# command line OTA distribution references and examples
# http://nachbaur.com/blog/how-to-automate-your-iphone-app-builds-with-hudson
# http://nachbaur.com/blog/building-ios-apps-for-over-the-air-adhoc-distribution
# http://blog.octo.com/en/automating-over-the-air-deployment-for-iphone/
# http://www.neat.io/posts/2010/10/27/automated-ota-ios-app-distribution.html
@iAladdin
iAladdin / gist:2342551
Created Apr 9, 2012 — forked from kavu/gist:1023207
Net::HTTP::Patch
View gist:2342551
require 'net/http'
require 'json'
class Net::HTTP::Patch < Net::HTTPRequest
METHOD = 'PATCH'
REQUEST_HAS_BODY = true
RESPONSE_HAS_BODY = true
end
url = URI.parse('https://api.github.com/iAladdin')
@iAladdin
iAladdin / .gitignore
Created Aug 19, 2011 — forked from ErikEvenson/.gitignore
Xcode 4 .gitignore file
View .gitignore
.DS_Store
*.swp
*~.nib
build/
*.pbxuser
*.perspective
*.perspectivev3
View NSDate+Extensions.m
@implementation NSDate (Extensions)
-(NSString *)timeAgo {
NSDate *now = [NSDate date];
double deltaMinutes = fabs([self timeIntervalSinceDate:now]) / 60.0f;
if (deltaMinutes < 60){
return @"a few minutes ago";
} else if (deltaMinutes < 120) {
return @"an hour ago";
} else if (deltaMinutes < (24 * 60)) {