Skip to content

Instantly share code, notes, and snippets.

@franciscoadasme
franciscoadasme / gist:999823
Created May 31, 2011 03:35
1PXJ hbond network output
A:CK2500:N3(4862) joined 0.0ps(0.0%) with 1 atoms bound
A:LYS33:NZ(530) joined 1940.058ps(96.9061876248%) with 0 atoms bound
A:CK2500:N7(4869) joined 0.0ps(0.0%) with 2 atoms bound
A:GLU81:O(1325) joined 1164.834ps(58.1836327345%) with 0 atoms bound
:SPC10068:O(35078) joined 1702.296ps(85.0299401198%) with 1 atoms bound
A:ASP145:OD1(2378) joined 1702.296ps(85.0299401198%) with 0 atoms bound
A:CK2500:N2A(4854) joined 0.0ps(0.0%) with 2 atoms bound
:SPC2463:O(12263) joined 275.724ps(13.7724550898%) with 2 atoms bound
A:ASP145:OD2(2379) joined 317.682ps(15.8682634731%) with 0 atoms bound
A:LYS33:NZ(530) joined 131.868ps(6.58682634731%) with 0 atoms bound
- (void)greeting
{
NSLog(@"hello world!");
}
@franciscoadasme
franciscoadasme / gist:1008136
Created June 4, 2011 17:54
brach:addfiles, MDMPackageCreator:generatePackages, fileGroup
2011-06-04 13:54:03.026 MDM[34502:903] <MDMPackageCreator: 0x20003d8a0>:generatePackages => fileGroup={(
<MDMFile:deepika_padukone_2011-1280x720.jpg>,
<MDMFile:deepika_padukone_2011-1600x900.jpg>,
<MDMFile:deepika_padukone_2011-1024x768.jpg>,
<MDMFile:deepika_padukone_2011-1152x864.jpg>,
<MDMFile:deepika_padukone_2011-2000x1000.jpg>
)}
2011-06-04 13:54:03.027 MDM[34502:903] <MDMPackageCreator: 0x20003d8a0>:generatePackages => fileGroup={(
<MDMFile:2011_super_8_movie-2560x1600.jpg>,
<MDMFile:2011_super_8_movie-1680x1050.jpg>,
@franciscoadasme
franciscoadasme / gist:1008620
Created June 5, 2011 03:40
How to show a custom title bar icon in NSWindow
// Force to show a titlebar icon
[window setRepresentedURL:[NSURL URLWithString:@"WindowTitle"]];
// Set our custom icon
[[window standardWindowButton:NSWindowDocumentIconButton] setImage:[NSImage imageNamed:@"imagename"]];
...
// Implement window delegate method to prevent to popup document (which do not exist) path menu when cmd+clicked
- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu
{
@franciscoadasme
franciscoadasme / gist:1008688
Created June 5, 2011 05:33
How to show a custom NSWindow as a sheet
// delegate will be notified that sheet did end calling to didEndSheet:returnCode:contextInfo:
[NSApp beginSheet:customWindow
modalForWindow:mainwindow
modalDelegate:delegate
didEndSelector:@selector(didEndSheet:returnCode:contextInfo:)
contextInfo:nil];
@franciscoadasme
franciscoadasme / gist:1008711
Created June 5, 2011 06:30
comparing two MDMFile
- (NSComparisonResult)compare:(id)object
{
if ([[self identifier] isEqualToString:[object identifier]]) return NSOrderedSame;
NSComparisonResult result = [[self identifier] compare:[object identifier]];
if (result != NSOrderedSame) return result;
return [[self fileName] compare:[object fileName]];
}
@franciscoadasme
franciscoadasme / gist:1009545
Created June 5, 2011 23:42
Bounce app dock tile
if (![NSApp isActive])
[NSApp requestUserAttention:NSCriticalRequest];
@franciscoadasme
franciscoadasme / gist:1021291
Created June 12, 2011 06:00
Text changed notification
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(textDidChange:)
name:NSControlTextDidChangeNotification
object:textField];
@franciscoadasme
franciscoadasme / gist:1021314
Created June 12, 2011 06:43
NSTextField delegate text changed notification
- (void)controlTextDidChange:(NSNotification *)notification
@franciscoadasme
franciscoadasme / gist:1079592
Created July 13, 2011 02:12
convert measure atom descriptions to a measure attributes list
def generateMeasureAtomIdx(st, measures):
measuresIdxs = []
if not measures: return measuresIdxs
for measure in measures.split(','):
atoms, importance = measure.split('@')
measureAttributes = { 'importance' : float(importance) }
for i, atomSelection in enumerate(atoms.split('-')):
atomAslExpr = shortAtomSelectionToAsl(atomSelection)
measureAttributes['atom%s' % i] = analyze.evaluate_asl(st, atomAslExpr)[0]