Skip to content

Instantly share code, notes, and snippets.

//
// RootViewController.swift
// iOS9Sampler
//
// Created by Shuichi Tsutsumi on 2015/06/10.
// Copyright © 2015 Shuichi Tsutsumi. All rights reserved.
//
import UIKit
@gfx
gfx / swfit-methods.md
Last active July 17, 2017 03:04
swiftでメソッドシグネチャどう書く問題

ドキュメントを書くとき、ObjCの setTile:forState: を Swfitでどう書くか。

setTitle(_: String!, forState: UIControlState)

フルパターン。

メリット:

  • 情報量が多くてわかりやすい
  • オーバーロードしていても曖昧でない
@ykst
ykst / gist:c1b38bbea93df28da3ed
Created January 28, 2015 14:05
iOSでもOpenCLを使えるか調べてみた

iOSでもOpenCLを使えるか調べてみた

いつまで経ってもPrivate Frameworksに引き蘢っているiOSのOpenCL APIは果たして本当に使えるのか? というわけでアプリから引き摺り出してみます。Jailbreakはしません。

とりあえずdlopen(3)してみる

Private Frameworksは基本的にSDK配下のものと同じパスでランタイムにdlopen(3)する事が出来るので、実機で開いてみます。

#import "AppDelegate.h"
@dealforest
dealforest / slack.py
Last active January 24, 2018 01:53
send to slack in LLDB
#!/usr/bin/env python
import lldb
def slack(debugger, command, result, internal_dict):
frame = lldb.debugger.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
path = command
lldb.debugger.HandleCommand("""
expr -l swift --
@keijiro
keijiro / houdini_engine.md
Last active January 26, 2018 19:34
Personal notes on Houdini Engine for Unity

Creating a Houdini asset

  • Select a group of nodes or a subnet node.
  • "Assets" -> "New Digital Asset From Selection..."

A Houdini asset file (.hdalc) will be created in the asset library directory ($HOUDINI_PATH/otls). To maintain this file within the Git repository, it should be moved into the project asset directory ($HIP/otls).

#!/usr/bin/env python
import argparse
import datetime
import os
import yaml
def main(args):
@cocopon
cocopon / GifRecorder.pde
Last active June 9, 2019 01:07
A class that makes it easy to record a sketch in animated GIF
/*
* GifRecorder - makes it easy to record a sketch in animated GIF
* (c) 2014 cocopon.
*/
import gifAnimation.*;
/*
* Usage:
*
* 0. Install a required library before using GifRecorder.
@toddheasley
toddheasley / UIImage.swift
Last active December 2, 2020 15:32
Animated GIF Support for UIImage
import UIKit
extension UIImage {
public enum GIFBehavior {
case unclamped, clamped(TimeInterval), webkit
fileprivate func duration(_ properties: Any?) -> TimeInterval? {
// Look for specified image duration; always prefer unclamped delay time
guard let properties: [String: Any] = (properties as? [String: Any])?["{GIF}"] as? [String: Any],
@captain-blue210
captain-blue210 / amazon_short_url_getter
Created January 20, 2021 02:15
Getting Amazon short URL
javascript: (function () {
const title = document.title.split('|')[0].trim();
const url = `https://www.amazon.co.jp/dp/${ue_pti}`;
const markdown = `[${title}](${url})`;
navigator.clipboard.writeText(markdown).then(function () {
alert(`URL Copied! : ${markdown}`);
}, function () {
alert('URL Copy failed..')
})