Skip to content

Instantly share code, notes, and snippets.

View Kentzo's full-sized avatar
🤖

Ilya Kulakov Kentzo

🤖
View GitHub Profile
@0xced
0xced / NSRunningApplication+DockIcon.h
Created March 15, 2012 16:00
NSRunningApplication category to dynamically show and hide any running application icon in the Dock
//
// Created by Cédric Luthi on 2011-05-03
// Copyright 2011-2012 Cédric Luthi. All rights reserved.
//
#import <AppKit/AppKit.h>
@interface NSRunningApplication (DockIcon)
- (BOOL) setDockIconHidden_xcd:(BOOL)dockIconHidden;
@Kentzo
Kentzo / AppKit.md
Created August 10, 2011 13:39
Hints for a Mac OS X Developer
@camillol
camillol / spaceutil.c
Created August 6, 2011 14:54
Two ways of messing with spaces
#include <unistd.h>
#include <CoreServices/CoreServices.h>
#include <ApplicationServices/ApplicationServices.h>
typedef int CGSConnection;
extern OSStatus CGSGetWorkspace(const CGSConnection cid, int *workspace);
extern OSStatus CGSSetWorkspace(const CGSConnection cid, int workspace);
extern CGSConnection _CGSDefaultConnection(void);
int get_space_id(void);
// Reads in a set of raw data files, and outputs smoothed files. (lots of libdispatch magic)
#define SIGMA (50)
#define CONST_A (1 / sqrt(2 * pi * (pow(SIGMA, 2))))
- (IBAction)smoothDataSets:(id)sender {
[openPanel beginSheetModalForWindow:self.window completionHandler:^(NSInteger ret){
if(ret == NSOKButton){
// Generate a gaussian weight
int len = 6 * SIGMA + 1;
double weight[len];
for(int i = 0; i < len; i++){
@PsychoH13
PsychoH13 / PSYBlockTimer.h
Created December 7, 2009 06:19
Fire an NSTimer using a block as execution code.
/*
Copyright (c) 2009 Remy Demarest
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following