Skip to content

Instantly share code, notes, and snippets.

View urouro-net's full-sized avatar

Kenta Nakai urouro-net

View GitHub Profile
unmap j
unmap k
unmap d
unmap u
unmap /
unmap gg
unmap G
unmap t
unmap x
@urouro-net
urouro-net / .m
Created July 21, 2020 14:18
NSStringの全角文字のみ□に変換する
NSMutableString *convertedText = [[NSMutableString alloc] initWithCapacity:[text length]];
for (NSUInteger i = 0; i < [text length]; i++) {
NSString *character = [text substringWithRange:NSMakeRange(i, 1)];
if (![character canBeConvertedToEncoding:NSASCIIStringEncoding]) {
character = @"□";
}
[convertedText appendString:character];
}
@urouro-net
urouro-net / .sh
Created May 23, 2020 02:53
XCLogParser CLI Tips
export PROJECT_DIR=$(pwd)
export PROJECT_NAME= # YOUR_PROJECT_NAME
source scripts/xclogparser.sh
@urouro-net
urouro-net / find-framework-uses-uiwebview.sh
Last active May 21, 2020 06:50
プロジェクト配下の UIWebView を使っている .framework を調べる
BOLD=$(tput bold)
NORMAL=$(tput sgr0)
FRAMEWORK_DIRS=$(find . -name '*.framework')
for framework in $FRAMEWORK_DIRS; do
fname=$(basename $framework .framework)
echo $BOLD$framework/$fname$NORMAL
nm $framework/$fname | grep UIWeb
echo ""
done
@urouro-net
urouro-net / gist:b74bab8222bd395e0c4bea227bfa79a9
Created April 8, 2020 06:13
Xcode 11.4 `xcodebuild --help`
Usage: xcodebuild [-project <projectname>] [[-target <targetname>]...|-alltargets] [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [-showBuildSettings [-json]] [<buildsetting>=<value>]... [<buildaction>]...
xcodebuild [-project <projectname>] -scheme <schemeName> [-destination <destinationspecifier>]... [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [-showBuildSettings [-json]] [-showdestinations] [<buildsetting>=<value>]... [<buildaction>]...
xcodebuild -workspace <workspacename> -scheme <schemeName> [-destination <destinationspecifier>]... [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [-showBuildSettings] [-showdestinations] [<buildsetting>=<value>]... [<buildaction>]...
xcodebuild -version [-sdk [<sdkfullpath>|<sdkname>] [-json] [<infoitem>] ]
xcodebuild -list [[-project <projectname>]|[-workspace <workspacename>]] [-json]
xcodebuild -show
@urouro-net
urouro-net / .swift
Created June 13, 2019 04:26
`AVURLAsset.audiovisualTypes()` list without `dyn.*` in iOS 12.3.1, iPhone X
for type in AVURLAsset.audiovisualTypes() {
if !type.rawValue.hasPrefix("dyn.") {
debugPrint("\(type.rawValue)")
}
}
@urouro-net
urouro-net / handler.js
Created June 28, 2018 03:41
Lambda + API Gateway Response Skelton
module.exports.handler = (event, context, callback) => {
const headers = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Credentials': true
};
const invalidResponse = {
statusCode: 400,
headers,
body: JSON.stringify({ error: 'Invalid.' })
};
@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'
@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 / 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 ]