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
## test method | |
def test_method(str) | |
puts str | |
return str | |
end | |
## call method | |
str = test_method("aaaaaa") |
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
// EDAMNoteの作成 | |
NSMutableDictionary *condition = [NSMutableDictionary dictionary]; | |
[condition setObject:@"sample note2" forKey:@"noteTitle"]; | |
EDAMNote *note = [self createEDAMNote:condition]; | |
// guidの設定 | |
NSString *guid = [[[metadata notes] objectAtIndex:0] guid]; | |
note.guid = guid; | |
// Update Note |
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
// 検索条件を設定する | |
EDAMNoteFilter *filter = [[EDAMNoteFilter alloc]init]; | |
NSString *keyword = @"fileName:fuga.txt"; | |
[filter setWords:keyword]; | |
// NotesMetadataResultSpec | |
EDAMNotesMetadataResultSpec *resultSpec = [[EDAMNotesMetadataResultSpec alloc]init]; | |
[resultSpec setIncludeTitle:YES]; | |
[resultSpec setIncludeNotebookGuid:YES]; | |
[resultSpec setIncludeTagGuids:YES]; |
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
// 文字列置換 | |
NSString *string =@"hogehogehoge"; // 置換対象文字列 | |
NSString *template = @"<br/>"; // 置換後文字列 | |
NSString *replaced = [string stringByReplacingOccurrencesOfString:@"\n" withString:template]; | |
// 文字列検索 <en-note>の開始位置を調べる | |
NSString *pattern = @"<en-note>"; | |
NSRange rangeFrom = [content rangeOfString:pattern]; | |
if(rangeFrom.location == NSNotFound){ | |
return nil; |
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
// テーブルの再描画 | |
- (void)reloadData; |
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
// エンコード | |
-(NSString*)encode:(NSString*)string{ | |
NSString *escapedString = (NSString*)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)string, NULL, (CFStringRef)@"!*'();:@&=+$,/?%#[]", kCFStringEncodingUTF8)); | |
return escapedString; | |
} | |
// デコード | |
-(NSString*)decode:(NSString*)string{ | |
NSString *decodedString = (NSString*)CFBridgingRelease(CFURLCreateStringByReplacingPercentEscapesUsingEncoding(kCFAllocatorDefault, (CFStringRef)string, CFSTR(""), kCFStringEncodingUTF8)); | |
return decodedString; |
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
// Webページを開く | |
- (IBAction)loadWebPage:(id)sender | |
{ | |
NSLog(@"load web page"); | |
NSString *urlAddress = [_urlField stringValue]; | |
NSURL *url = [NSURL URLWithString:urlAddress]; | |
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; | |
[[_webView mainFrame] loadRequest:requestObj]; | |
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
NSString *errorMsg = @"Are you sure you want to delete this Upload Rule?"; | |
if(errorMsg.length != 0){ | |
NSAlert *alert = [ NSAlert alertWithMessageText: @"hoge" | |
defaultButton: @"OK" // 1 | |
alternateButton: @"Cancel" // 0 | |
otherButton: nil // -1 | |
informativeTextWithFormat: @"%@", errorMsg]; | |
NSLog(@"%ld",[alert runModal]); |
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
NSOpenPanel *panel = [NSOpenPanel openPanel]; | |
[panel setCanChooseFiles:NO]; | |
[panel setCanChooseDirectories:YES]; | |
[panel setAllowsMultipleSelection:YES]; // yes if more than one dir is allowed | |
NSInteger clicked = [panel runModal]; | |
if (clicked == NSFileHandlingPanelOKButton) { | |
for (NSURL *url in [panel URLs]) { | |
// do something with the url here. | |
NSLog(@"url:%@", [url path]); | |
} |
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
// delegateの取得 | |
AppDelegate *appDelegate = (AppDelegate*)[[NSApplication sharedApplication] delegate]; | |