Skip to content

Instantly share code, notes, and snippets.

@hetima
hetima / 01_setMenuProxy.m
Created July 27, 2011 10:27
WebKit2 context menu hack
// based on http://d.hatena.ne.jp/uasi/20110722/1311275712
IMP orig_setMenuProxy;
// オリジナルの setMenuProxy: と差し替えるメソッド
void ST_setMenuProxy(id self, SEL _cmd, void *menuProxy)
{
// オリジナルのメソッドを呼んでやる
orig_setMenuProxy(self, _cmd, menuProxy);
// menuProxy は WebContextMenuProxyMac クラスのポインタ
@hetima
hetima / safari_cmenu_item_tags.txt
Created July 31, 2011 16:00
Safari 5.1 context menu item tags
戻る, 9
進む, 10
ページを再読み込み, 10018
Dashboard で開く..., 10031
-
ソースを表示, 10019
ページを別名で保存..., 10021
ページをプリント..., 10025
-
要素の詳細を表示, 2024
@hetima
hetima / BrowserWindowControllerMac.diff.h.m
Created August 1, 2011 13:42
difference between Safari5.1 Snow Leopard and Lion
//Lion にあって Snow Leopard にないメソッドや変数
@interface BrowserWindowControllerMac : WindowController{
BOOL _isObservingFrameChangeNotifications;
int _fullScreenState;
struct CGRect _windowFrameBeforeFullScreen;
struct CGPoint _browserViewScreenOriginBeforeFullScreen;
NSMutableSet *_fullScreenAutoShowingBars;
NSMutableSet *_fullScreenAlwaysVisibleBars;
double _fullScreenAuxiliaryViewMinHeight;
@hetima
hetima / setFileTypeAndCreator.m
Created August 3, 2011 11:33
set FileType And Creator on i386 x86_64
//i386 x86_64用
//needs CoreServices.framework
BOOL setFileTypeAndCreator(NSString* asFilePath, const char* typeStr, const char* creatorStr);
UInt32 OSTypeFromString(const char* inStr);
UInt32 OSTypeFromString(const char* inStr)
{
UInt32 outType;
char *buff;
@hetima
hetima / (1)STWKClientHook.m
Created August 14, 2011 15:31
WebKit2 WKView client hook for Safari 5.1
//
// STWKClientHook.m
#import "STWKClientHook.h"
#import <objc/message.h>
struct STWKOrderedClientCluster{
struct WKPageLoaderClient loader;
struct WKPagePolicyClient policy;
struct WKPageFormClient form;
@hetima
hetima / make new Finder window with ScriptingBridge.m
Last active December 12, 2015 07:58
ScriptingBridge で make new Finder window する方法
//ScriptingBridge で make new Finder window
FinderApplication* app = [SBApplication applicationWithBundleIdentifier:@"com.apple.finder"];
FinderFinderWindow* w = [app sendEvent:'core' id:'crel' parameters:'kocl', @"brow", 0];
//表示するフォルダを指定したい場合はこう(文字列で直接指定する場合旧式の:区切りパス)
FinderFinderWindow* w = [app sendEvent:'core' id:'crel' parameters:'kocl', @"brow",
'to ', @"Path:to:folder",
0];
@hetima
hetima / gist:4745314
Created February 9, 2013 13:37
ScriptingBridge で as 〜 表現
//Same as "target of window as Unicode text"
FinderFinderWindow* window;
FinderFolder* folder=window.target;
NSString* str = [folder sendEvent:'core' id:'getd' parameters:'rtyp', @"utxt", 0];
@hetima
hetima / gist:4967007
Created February 16, 2013 13:52
runAnimationGroup and dispatch_after
+ (void)showNotificationString:(NSString*)label inView:(NSView*)parentView
{
NSRect frame=parentView.frame;
frame.origin=NSZeroPoint;
frame.size.height=20;
frame.origin.y-=frame.size.height;
DTNotificationView* noteView=[[DTNotificationView alloc]initWithFrame:frame];
noteView.label=label;
[parentView addSubview:noteView];
@hetima
hetima / gist:5107613
Created March 7, 2013 12:11
Sequel Pro のプラグイン(bundles)サンプル(php)
#!/usr/bin/php
<?php
/*
Sequel Pro のプラグイン(bundles)サンプル
needs PHP 5.3 or later because of str_getcsv()
copy field names to clipboard
*/
$table = $_ENV['SP_SELECTED_TABLE'];
@hetima
hetima / gist:5142318
Created March 12, 2013 11:52
NSScrollView のスクロール位置を同期する
@interface SSRefrectingScrollView : NSScrollView
@property BOOL inRefrecting;
@property (assign)IBOutlet SSRefrectingScrollView* counterPartView;
@end
@implementation SSRefrectingScrollView