Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View devxoul's full-sized avatar
👨‍💻
Always coding

Suyeol Jeon devxoul

👨‍💻
Always coding
View GitHub Profile
@devxoul
devxoul / localizable-encoding.sh
Last active August 29, 2015 14:05
Convert `Localizable.strings` file encoding to such encoding.
#!/bin/sh
ENCODING="utf-8"
for file in *.lproj/Localizable.strings; do
charset=`file -I "$file" | sed 's/.*charset=\(.*\)/\1/'`
if ! [[ "$charset" =~ "$ENCODING" ]]
then
output="$file.tmp"
iconv -f "$charset" -t "$ENCODING" "$file" > "$output" &&
@devxoul
devxoul / regex-find-unlocalized.txt
Created August 21, 2014 06:02
A regular expression for finding unlocalized string in Objective-c files.
(?<!NSLocalizedString\()(?<!NSLog\()(?<!patternname:)(?<!imageNamed:)(?<!key:)(?<!@\{)(?<!\[)@".+"
@devxoul
devxoul / naver-cafe-chat-left-message.js
Last active August 29, 2015 14:06
네이버 카페에서 내 채팅을 왼쪽 정렬로 보이게 하는 스크립트
document.body.appendChild($('<style>div.my.msg{text-align:left;}</style>'));
@devxoul
devxoul / shout.xoul.kr
Created September 26, 2014 17:05
Nginx configuration for shout.xoul.kr.
server {
listen 80;
server_name shout.xoul.kr;
location / {
proxy_pass http://127.0.0.1:4321;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
@devxoul
devxoul / github-monospace-editor.js
Created October 7, 2014 06:11
GitHub Monospace Editor
// ==UserScript==
// @name GitHub Monospace Editor
// @namespace http://xoul.kr/github-monospace-editor
// @version 0.1.0
// @description Monospace GitHub Editor
// @match github.com/*/*/*
// @copyright 2014, devxoul
// ==/UserScript==
$(document.head).append($('<style>#pull_request_body { font-family: monospace; }</style>'));

Runtime Version Check

There are several ways to check for new features provided by the Cocoa frameworks at runtime. One is to look for a given new class or method dynamically, and not use it if not there. Another is to use the global variable NSAppKitVersionNumber (or, in Foundation, NSFoundationVersionNumber):

double NSAppKitVersionNumber;
#define NSAppKitVersionNumber10_0 577
#define NSAppKitVersionNumber10_1 620
#define NSAppKitVersionNumber10_2 663
#define NSAppKitVersionNumber10_3 743
@devxoul
devxoul / line-length-linter.sh
Last active August 29, 2015 14:09
Maximum line length limitation linter script.
#!/bin/bash
##
# The MIT License (MIT)
#
# Copyright (c) 2013-2014 Suyeol Jeon (http://xoul.kr)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
@devxoul
devxoul / CGFloatLiteral.swift
Created June 29, 2015 09:01
CGFloatLiteral
The MIT License (MIT)
Copyright (c) 2015 Suyeol Jeon
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@devxoul
devxoul / check-entitlements.sh
Created July 28, 2015 07:57
Check StyleShare.ipa entitlements.
cp build/StyleShare.ipa build/StyleShare.zip
unzip build/StyleShare.zip -d build
codesign -d --entitlements :- "build/Payload/StyleShare.app"
security cms -D -i "build/Payload/StyleShare.app/embedded.mobileprovision" # | grep -i group
@devxoul
devxoul / Weakify.swift
Last active October 5, 2015 17:10
Experimental weakify and strongify in Swift using Generic.
// The MIT License (MIT)
//
// Copyright (c) 2015 Suyeol Jeon (xoul.kr)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions: