Skip to content

Instantly share code, notes, and snippets.

View urouro-net's full-sized avatar

Kenta Nakai urouro-net

View GitHub Profile
@urouro-net
urouro-net / .m
Created August 5, 2016 02:39
Objective-CからSwiftのCocoaPodsを読む
#import "ModuleName-Swift.h"
[
{
"keys": ["ctrl+i"],
"command": "reindent",
"args": {
"single_line": true
}
},
{
@urouro-net
urouro-net / .swift
Created January 10, 2017 13:47
Swift Load nib
let view = Bundle.main.loadNibNamed("PreviewHeaderView", owner: self, options: nil)![0]
@urouro-net
urouro-net / gist:ba338649dcb59d1f32af4555e58c10f3
Created January 15, 2017 10:12
Swift 3, Caluculate view size
let string: NSString = place as NSString
let attributes: [String: AnyObject] = [NSFontAttributeName: UIFont(name: "HiraKakuProN-W6", size: 10.0)!]
let labelHeight: CGFloat = 14.0
let size: CGSize = string.boundingRect(
with: CGSize(width: CGFloat.greatestFiniteMagnitude, height: labelHeight),
options: .usesLineFragmentOrigin,
attributes: attributes,
context: nil).size
@urouro-net
urouro-net / Vimium-and-BTT_BTT
Last active February 10, 2017 02:41
Vimium + BTT
⌥V -> ⇧^V
⇧⌥, -> ⇧^,
⇧⌥. -> ⇧^.
@urouro-net
urouro-net / .swift
Last active November 3, 2018 08:04
PHAsset Exif
let editOptions = PHContentEditingInputRequestOptions()
editOptions.isNetworkAccessAllowed = true
asset.requestContentEditingInput(with: editOptions) { (contentEditingInput: PHContentEditingInput?, info: [AnyHashable : Any]) in
if let fileURL = contentEditingInput?.fullSizeImageURL {
let image = CIImage(contentsOf: fileURL)
log.debug("properties=\(image?.properties)")
if let gps = image?.properties["{GPS}"] as? [AnyHashable : Any] {
@urouro-net
urouro-net / .md
Last active February 6, 2017 14:04
Hello ``` World ```

[Google][google]

[This is also Google][google]

@urouro-net
urouro-net / pre-push
Created July 20, 2017 03:21
.git/hooks/pre-push
#!/bin/sh
remote="$1"
url="$2"
z40=0000000000000000000000000000000000000000
while read local_ref local_sha remote_ref remote_sha
do
if [ "$local_sha" = $z40 ]
@urouro-net
urouro-net / example.swift
Last active October 23, 2017 10:58
TwitterKit 💢
// To debug, sign out from this app.
if let session = Twitter.sharedInstance().sessionStore.session() {
Twitter.sharedInstance().sessionStore.logOutUserID(session.userID)
}
if let session = Twitter.sharedInstance().sessionStore.session() {
debugPrint("Session: \(String(describing: session))")
debugPrint("Existing: \(Twitter.sharedInstance().sessionStore.existingUserSessions())")
tweet()
} else {
@urouro-net
urouro-net / crashfree.rb
Created April 20, 2018 03:58
Sentry Crash Free Rate Calcuration
# An example for calculation of the crash free rate with Sentry.
# This example calculates the crash free rate yesterday.
require 'json'
require 'net/http'
require 'uri'
# Set your API Token
# https://sentry.io/api/
SENTRY_API_TOKEN = 'xxx'