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
tell application "Xcode" | |
if (frontmost of it = false) then | |
return | |
end if | |
set documentList to source document of it | |
set listLength to count of documentList | |
if listLength is less than 1 then | |
return --no opened source file in working space | |
end if |
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
# Uncrustify 0.58 | |
newlines = auto | |
input_tab_size = 4 | |
output_tab_size = 4 | |
string_escape_char = 92 | |
string_escape_char2 = 0 | |
tok_split_gte = false | |
indent_columns = 4 | |
indent_continue = 0 | |
indent_with_tabs = 0 |
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
db := openDB() | |
defer closeDB(db) | |
stmt, err := db.Prepare("INSERT INTO book(title,author,content,createdtime) VALUES($1,$2,$3,$4)") | |
if err != nil { | |
return err | |
} | |
_, err = stmt.Exec(b.Title, b.Author, b.Content, b.CreatedTime) | |
if err != nil { | |
return err | |
} |
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
UPDATE table SET field='C', field2='Z' WHERE id=3; | |
INSERT INTO table (id, field, field2) | |
SELECT 3, 'C', 'Z' | |
WHERE NOT EXISTS (SELECT 1 FROM table WHERE id=3); |
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
find ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins -name Info.plist -maxdepth 3 | xargs -I{} defaults write {} DVTPlugInCompatibilityUUIDs -array-add `defaults read /Applications/Xcode.app/Contents/Info.plist DVTPlugInCompatibilityUUID` |
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
How Do I Declare A Block in Objective-C? | |
As a local variable: | |
returnType (^blockName)(parameterTypes) = ^returnType(parameters) {...}; | |
As a property: | |
@property (nonatomic, copy) returnType (^blockName)(parameterTypes); | |
As a method parameter: |