Skip to content

Instantly share code, notes, and snippets.

@capttaco
capttaco / Fetchable.swift
Last active May 3, 2019 17:28
A utility protocol for custom NSManagedObjects that makes querying contexts simpler and more convenient. Requires Swift 2.
import CoreData
protocol Fetchable
{
typealias FetchableType: NSManagedObject
static func entityName() -> String
static func objectsInContext(context: NSManagedObjectContext, predicate: NSPredicate?, sortedBy: String?, ascending: Bool) throws -> [FetchableType]
static func singleObjectInContext(context: NSManagedObjectContext, predicate: NSPredicate?, sortedBy: String?, ascending: Bool) throws -> FetchableType?
static func objectCountInContext(context: NSManagedObjectContext, predicate: NSPredicate?) -> Int
@audreyt
audreyt / gist:60da332160e0b31d004f
Last active October 23, 2021 14:09
開放近用游擊宣言。based on early work from: http://bobluonnews.blogspot.tw/2013/01/rip-aaron-swartz.html

開放近用游擊宣言

資訊就是力量。總是有人想要獨佔力量,資訊也不例外。

全世界的科學和文化遺產、出版了幾百年的書籍和期刊,正逐步由少數私人公司數位化並上鎖。想讀最有名的科學論文嗎?你得付一大筆錢給 Reed Elsevier 這類出版商。

有些人力圖改變這種現況。「開放近用運動」奮勇抵抗,以確保科學家們不要將他們的著作權簽給別人,讓他們的作品能在網際網路上,採取允許任何人近用的條款發表。但即使在最樂觀的情況下,他們的努力也只適用於未來新發表的作品。先前的一切,都已經失去。

這是我們付不起的代價。強制學者付錢讀他們同事的作品?掃描整個圖書館,但只讓人在 Google 閱讀?只提供科學文章給第一世界的菁英大學,而不給在南半球的兒童?這些是不可接受的暴行。

@matthewmueller
matthewmueller / osx-for-hackers.sh
Last active April 21, 2024 03:30
OSX for Hackers (Mavericks/Yosemite)
# OSX for Hackers (Mavericks/Yosemite)
#
# Source: https://gist.github.com/brandonb927/3195465
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Ask for the administrator password upfront
Measuring Matx A * B...
Measurement finished. Matx A * B: 5.121e-05
Measuring Mat A * B ref stack memory...
Measurement finished. Mat A * B ref stack memory: 1.04867
Measuring Mat A * B ref heap memory...
Measurement finished. Mat A * B ref heap memory: 1.52618
@bomberstudios
bomberstudios / sketch-plugins.md
Last active February 26, 2024 07:02
A list of Sketch plugins hosted at GitHub, in no particular order.
@johanneswuerbach
johanneswuerbach / .travis.yml
Last active May 14, 2024 03:50
Deploy an iOS app to testflight using Travis CI
---
language: objective-c
before_script:
- ./scripts/travis/add-key.sh
after_script:
- ./scripts/travis/remove-key.sh
after_success:
- ./scripts/travis/testflight.sh
env:
global:
@ccgus
ccgus / Xcode crash report
Created February 23, 2013 19:02
Xcode crash report whoa
Application Specific Information:
ProductBuildVersion: 4H127
ASSERTION FAILURE in /SourceCache/IDEInterfaceBuilder/IDEInterfaceBuilder-3084/Framework/Connections/Interface/IBConnectionPopUpMenu.m:388
Details: Need a menu.
Function: NSMenuItem *IBPopUpConnectionMenuWithMenuItems(NSArray *, NSMenuItem *, NSEvent *, NSRect, BOOL, NSSet *, CGFloat, NSWindow *, NSColor *, NSColor *, NSColor *, NSColor *, id<IBConnectionPopUpMenuDelegate>)
Thread: <NSThread: 0x40030a1e0>{name = (null), num = 1}
Hints: None
Backtrace:
0 0x000000010c77b249 -[IDEAssertionHandler handleFailureInFunction:fileName:lineNumber:messageFormat:arguments:] (in IDEKit)
1 0x000000010ba2ec65 _DVTAssertionHandler (in DVTFoundation)
@ole
ole / update_storyboard_strings.sh
Last active April 4, 2022 06:11
Automatically extract translatable strings from Xcode storyboards and update .strings files. Original version by MacRumors forum user mikezang (http://forums.macrumors.com/showpost.php?p=16060008&postcount=4). Slightly updated by Ole Begemann. NOTE: this Gist moved to a regular repo at https://github.com/ole/Storyboard-Strings-Extraction.
# (File moved to https://github.com/ole/Storyboard-Strings-Extraction)
@fajrif
fajrif / rvm_cheatsheet
Created June 14, 2011 14:11
RVM cheatsheet
RVM home page: http://rvm.beginrescueend.com
Install RVM
------------
See http://rvm.beginrescueend.com/rvm/install/
bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
Install rvm for all users