Skip to content

Instantly share code, notes, and snippets.

@leotm
leotm / default_syntax.py
Last active July 9, 2020 18:54
Sublime Text 3 - Set default syntax
# AppData\Roaming\Sublime Text 3\Packages\User\default_syntax.py
import sublime, sublime_plugin
class DefaultSyntaxCommand(sublime_plugin.EventListener):
def on_new(self, view):
# Replace <Language> with desired default language
# Check in AppData\Local\Sublime Text 3\Cache
view.set_syntax_file('Packages/<Language>/<Language>.tmLanguage')
@davbeck
davbeck / GQL.swift
Created May 2, 2015 15:52
GraphQL data structure implemented in Swift
import Foundation
protocol GQLNodeArgument {}
extension String: GQLNodeArgument {}
extension NSNumber: GQLNodeArgument {}
class GQLNode: StringLiteralConvertible, ArrayLiteralConvertible, Printable, DebugPrintable {
let name: String?
@eralston
eralston / NSArray+WeakArray.h
Last active July 5, 2023 09:11
An pair of Objective-C categories on NSArray and NSMutableArray that provides a mechanism for weak referencing any type of Objective-C object. This was created when I found a case, referencing protocols, where NSPointerArray did not work for my needs.
//
// NSMutableArray+WeakArray.h
//
#import <Foundation/Foundation.h>
///
/// Category on NSArray that provides read methods for weak pointers
/// NOTE: These methods may scan the whole array
///
@katylava
katylava / git-selective-merge.md
Last active February 27, 2024 10:18
git selective merge

Update 2022: git checkout -p <other-branch> is basically a shortcut for all this.

FYI This was written in 2010, though I guess people still find it useful at least as of 2021. I haven't had to do it ever again, so if it goes out of date I probably won't know.

Example: You have a branch refactor that is quite different from master. You can't merge all of the commits, or even every hunk in any single commit or master will break, but you have made a lot of improvements there that you would like to bring over to master.

Note: This will not preserve the original change authors. Only use if necessary, or if you don't mind losing that information, or if you are only merging your own work.