Skip to content

Instantly share code, notes, and snippets.

View rbugajewski's full-sized avatar
🔨

Rafael Bugajewski rbugajewski

🔨
View GitHub Profile
@steipete
steipete / gist:1501754
Created December 20, 2011 14:34
Use Xcode to automatically set git hash
git=`sh /etc/profile; which git`
version=`$git describe --tags --always`
count=`$git rev-list --all |wc -l`
echo -e "#define GIT_VERSION $version\n#define GIT_COMMIT_COUNT $count" > InfoPlist.h
@ccgus
ccgus / gist:1762511
Created February 7, 2012 22:14
Auto-gitify
function runGitWithArgsForDocument(document, args) {
task = NSTask.alloc().init().autorelease();
task.setCurrentDirectoryPath(document.fileURL().path());
task.setLaunchPath('/usr/bin/git');
task.setArguments(args);
task.launch();
task.waitUntilExit();
}
function documentWasOpened(document) {
@kristianfreeman
kristianfreeman / atv.md
Created August 1, 2012 03:15
ATV Screensavers

The Apple TV has some nice pictures for screensavers, but there's only about ~20 on average for each screensaver set. Luckily, with a jailbroken Apple TV, we can replace them pretty easily.

The screensaver images are located at /System/Library/PrivateFrameworks/AppleTV.framework/Default[Album]Photos. I like SFTP'ing in with Cyberduck.

There are multiple screensaver sets — if you have a set you like the least (maybe "FlowerPhotos"?), replace those.

The files are in a pretty basic format:

01.jpg
02.jpg
@r10r
r10r / skitch2png.rb
Created May 29, 2012 06:11
Extract PNG data from .skitch SVG files
#!/usr/bin/env ruby
# extracts the embedded PNG data from .skitch SVG files
require 'nokogiri'
require 'base64'
IMAGE_HEADER = "data:image/png;base64,"
ARGV.each do |filename|
svg_document = Nokogiri::XML(File.open(filename))
@catlan
catlan / Document.m
Last active August 7, 2019 21:31
Pages.app like moveToURL:completionHandler: impl. NSIsRelatedItemType key in Info.plist is required
- (void)moveToURL:(NSURL *)url completionHandler:(void (^ __nullable)(NSError * __nullable))completionHandler
{
NSError *error = nil;
NSURL *adjustedURL = nil;
if (![[url pathExtension] isEqualToString:@"testextension"]) {
adjustedURL = [url URLByAppendingPathExtension:@"testextension"];
}
@klemenzagar91
klemenzagar91 / MulticastDelegateV2.swift
Created June 22, 2017 12:16
Multicast Delegate with hash table
class MulticastDelegate <T> {
private let delegates: NSHashTable<AnyObject> = NSHashTable.weakObjects()
func add(delegate: T) {
delegates.add(delegate as AnyObject)
}
func remove(delegate: T) {
for oneDelegate in delegates.allObjects.reversed() {
if oneDelegate === delegate as AnyObject {
@ericlbarnes
ericlbarnes / .bowerrc
Created January 17, 2015 03:33
Laravel Elixir With Bootstrap Sass
{
"directory": "vendor/bower_components"
}
@mminer
mminer / PreferencesViewController.swift
Last active February 5, 2021 19:43
NSTabViewController for preferences window that resizes itself to fit activated tab view.
import AppKit
class PreferencesViewController: NSTabViewController {
private lazy var tabViewSizes: [NSTabViewItem: NSSize] = [:]
override func tabView(_ tabView: NSTabView, didSelect tabViewItem: NSTabViewItem?) {
super.tabView(tabView, didSelect: tabViewItem)
if let tabViewItem = tabViewItem {
@ColinEberhardt
ColinEberhardt / Swift Events
Created February 11, 2015 09:15
An eventing mechanism for Swift
/// An object that has some tear-down logic
public protocol Disposable {
func dispose()
}
/// An event provides a mechanism for raising notifications, together with some
/// associated data. Multiple function handlers can be added, with each being invoked,
/// with the event data, when the event is raised.
public class Event<T> {
@madmax
madmax / gist:1474059
Created December 13, 2011 21:54
changing font in textmate 2
1. Open Bundle editor
2. Select Themes -> Themes -> your theme
3. add to settings
fontName = 'Monaco';
fontSize = '12px';
or what you want, enjoy :)