Skip to content

Instantly share code, notes, and snippets.

View susieyy's full-sized avatar

yohei sugigami susieyy

View GitHub Profile
//
// CoreDateManager.h
//
// Created by haoyayoi on 09/12/28.
// Copyright 2009 haoyayoi. All rights reserved.
//
#import <Foundation/Foundation.h>
@mono0926
mono0926 / embedded_frameworks.md
Last active March 16, 2017 01:35
複数アプリでコード共有する時の構成

上から下に依存

  • アプリA
  • アプリB
  • アプリC

それぞれレイヤー構成によって複数あり得る:

@gre
gre / AutoCaptureGLThing.js
Last active August 23, 2017 10:42
example that render things offscreen with gl-react – would love if you find a way to make this use-case less hacky
class AutoCaptureGLThing extends Component {
onRef = exportable => {
if (!exportable || this.exporting) return;
this.exporting = true;
exportable.captureFrame(/* see https://projectseptemberinc.gitbooks.io/gl-react/content/docs/api/Surface.html */)
.then(path => { // oops back to node callback pattern via props callback
this.props.onCapture(null, path);
}, error => {
this.props.onCapture(error);
});
@corosukeK
corosukeK / gist:f5fc72d472d930991067
Created September 10, 2015 07:23
Syncで使われているライブラリ(ライセンス表記から抽出した)
・Cocoapods
AF+Image+Helper
ARChromeActivity
Aspects
Bolts
CocoaSecurity
Colours
Crashlytics
DACircularProgress
#! bin/sh
NAME=$1
input="${NAME}Inputs"
output="${NAME}Outputs"
protocol="${NAME}Type"
cat << EOL
protocol ${input} {
@kylesluder
kylesluder / AsyncAwait.swift
Last active May 15, 2020 06:01
A C#-style Async/Await implementation in Swift
// A much better version of C#-style Async/Await. It can return values!
import Cocoa
struct Await<T> {
// private
let group: dispatch_group_t
let getResult: () -> T
// public
func await() -> T { return getResult() }
#!/usr/bin/env xcrun swift -F Carthage/Build/Mac
import Foundation
import Markingbird
protocol Streamable {
var title: String { get }
var body: String { get }
}

Protocol Buffersで高速な通信を型安全に実現する

最近AppleがProtocol Buffersの公式プラグインをGitHubに公開して話題になったので、実際に使ってみました。APIの通信が速くなったり、型安全に通信処理を書ける など、メリットが多いと感じたので簡単に紹介します。

他の事例だと、iOSオールスターズ2で発表された「これから始めるProtocol Buffers導入」が非常に参考になると思うので併せて読んでみてください。

この記事ではProtocol Buffersの概要について書いています。別途こちらの記事で使い方について サンプルを使って説明している ので、併せて読んでみてください。

Protocol Buffersとは

@DrewML
DrewML / Theming-Slack-OSX.md
Last active January 25, 2022 00:53
Theming Slack for OSX

Theming Slack for OSX

So, you love Slack, but you hate applications with large white backgrounds? Why not use Dark Mode!

Unfortunately, Slack does not have a Dark Mode, although it's on their list of possibilities.

But, don't fret - there is a solution! Because the slack native desktop apps are just wrappers around a web app, we can inject our own CSS to customize the application to our liking.

How to (OSX Only)

@kgn
kgn / gist:1558664
Created January 4, 2012 05:37
Animated NSTableView Scrolling
// Thanks to CuriousKea for getting this started!
// http://stackoverflow.com/a/8480325/239380
- (void)scrollRowToVisible:(NSInteger)rowIndex animate:(BOOL)animate{
if(animate){
NSRect rowRect = [self rectOfRow:rowIndex];
NSPoint scrollOrigin = rowRect.origin;
NSClipView *clipView = (NSClipView *)[self superview];
scrollOrigin.y += MAX(0, round((NSHeight(rowRect)-NSHeight(clipView.frame))*0.5f));
NSScrollView *scrollView = (NSScrollView *)[clipView superview];