Skip to content

Instantly share code, notes, and snippets.

//Safari 7
struct WebContextMenuProxyMac {
CDUnknownFunctionPointerType *_field1;
unsigned int _field2;
struct RetainPtr<NSPopUpButtonCell> _field3;
id _field4;
struct WebPageProxy *_field5;
};
//Safari 8
@hetima
hetima / gist:465b897da0f03e9288b9
Last active August 29, 2015 14:00
KZRMETHOD_SWIZZLING_WITHBLOCK
#define KZRMETHOD_SWIZZLING_WITHBLOCK(className, selectorName, isClassMethod, originalIMP, originalSelector, block) {\
BOOL _val_isClassMethod=isClassMethod; \
const char* _val_selName=selectorName; \
if(*_val_selName=='+'){_val_isClassMethod=YES; _val_selName++;} \
Class _val_cls=objc_getClass(className); \
SEL originalSelector=sel_registerName(_val_selName); \
Method _val_originalMethod; \
if (_val_isClassMethod)_val_originalMethod = class_getClassMethod(_val_cls, originalSelector); \
else _val_originalMethod = class_getInstanceMethod(_val_cls, originalSelector); \
KZRIMPUnion originalIMP = (KZRIMPUnion)(IMP)method_getImplementation(_val_originalMethod); \
@hetima
hetima / gist:11212483
Created April 23, 2014 11:56
Reminders.app 実行するたび締め切りが延びる魔法のスクリプト
tell application "Reminders"
set reminderTitle to "Shimekiri"
set listTitle to "work"
set workerList to list listTitle
-- remove old reminder
set ids to {}
repeat with r in reminder of workerList
if name of r is reminderTitle then

#DVTPlugInCompatibilityUUID

  • 5.0 : 37B30044-3B14-46BA-ABAA-F01000C27B63
  • 5.1 : A2E4D43F-41F4-4FB9-BB94-7177011C9AED
  • 6.0 beta : AD68E85B-441B-4301-B564-A45E4919A6AD
  • 6.0, 6.1 : C4A681B0-4A26-480E-93EC-1218098B9AA0
  • 6.2 : A16FF353-8441-459E-A50C-B071F53F51B7
  • 6.3 : 9F75337B-21B4-4ADC-B558-F9CADF7073A7
  • 6.3.2 : E969541F-E6F9-4D25-8158-72DC3545A6C6
  • 6.4 : 7FDF5C7A-131F-4ABB-9EDC-8C5F8F0B8A90
NS_INLINE CGFloat NSWidth(NSRect aRect) {
return (aRect.size.width);
}
#define NSWidth(aRect) ({aRect.size.width;})
NSImage* lightImage;
{
lightImage=[[NSImage alloc]initWithSize:[image size]];
[lightImage lockFocus];
NSRect rect=NSZeroRect;
rect.size=[image size];
[image drawAtPoint:NSZeroPoint fromRect:rect operation:NSCompositeCopy fraction:0.4];
[lightImage unlockFocus];
}
@hetima
hetima / private.xml
Created April 24, 2013 05:26
test: functional key to shift key with KeyRemap4MacBook
<?xml version="1.0"?>
<root>
<item>
<name>FKEY to Shift_L</name>
<appendix>(+ When you type FKEY only, send FKEY)</appendix>
<identifier>private.fkey2shiftL_fkey</identifier>
<autogen>__KeyOverlaidModifier__ KeyCode::F1, KeyCode::SHIFT_L, KeyCode::F1</autogen>
<autogen>__KeyOverlaidModifier__ KeyCode::F2, KeyCode::SHIFT_L, KeyCode::F2</autogen>
<autogen>__KeyOverlaidModifier__ KeyCode::F3, KeyCode::SHIFT_L, KeyCode::F3</autogen>
<autogen>__KeyOverlaidModifier__ KeyCode::F4, KeyCode::SHIFT_L, KeyCode::F4</autogen>
@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
@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: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];