Skip to content

Instantly share code, notes, and snippets.

mytory /
Created Apr 8, 2019 — forked from emotality/
Xcode - Duplicate Line key binding

Xcode line duplicate

Bind keys to duplicate lines in Xcode

  1. Open below directory in Finder with Cmnd + Shift + G
mytory /
Created Oct 11, 2018 — forked from DragonBe/
Installation of Apache 2.4 and PHP 7.1 with Homebrew

I posted several talks about compiling PHP from source, but everyone was trying to convince me that a package manager like Homebrew was a more convenient way to install.

The purpose of Homebrew is simple: a package manager for macOS that will allow you to set up and install common packages easily and allows you to update frequently using simple commands.

I used a clean installation of macOS Sierra to ensure all steps could be recorded and tested. In most cases you already have done work on your Mac, so chances are you can skip a few steps in this tutorial.

Apache and PHP with homebrew

I’ve made this according to the installation instructions given on GetGrav.

mytory / short-open-tag-converter.php
Last active Sep 30, 2018
Change short open tag to long open tag.
View short-open-tag-converter.php
// This script convert short open tag to long open tag.
// Inspired from
// Source:
// Usage: php short-open-tag-converter.php target_file_path.php
// Notice: This script change original file.
// If you want to change '<?=' to '<?php echo ' uncomment line 45~50.
mytory / Dockerfile
Created Aug 7, 2018
Dockerfile basic template for Korean ubuntu user.
View Dockerfile
FROM ubuntu:18.04
ENV DEBIAN_FRONTEND=noninteractive
# repository
RUN sed -i 's|||g' /etc/apt/sources.list
RUN apt-get update
RUN apt-get upgrade -y
# timezone
mytory / fetch-attachment.js
Created Aug 18, 2016 — forked from hasinhayder/fetch-attachment.js
Fetch WordPress Media Files (Attachments) Via Backbone Model
View fetch-attachment.js
var attachment_id = 1234;
var attachment = new;
if (_.contains(['png','jpg','gif','jpeg'],att.get('subtype'))) {
mytory / webfont.js
Created Jun 15, 2016
Updated version of 'The deferred font loading logic for Smashing Magazine' by An, Hyeong-woo.
View webfont.js
(function () {
"use strict";
// 스매싱 매거진의 '지연된 웹폰트 불러오기' javascript를 안형우가 수정한 것.
// 한 번 캐시하면 css 파일은 클라이언트 측에 저장한다.
// 아래 css_href 가 바뀌면 그 때 다시 받는다.
// woff base64를 내장한 css
var css_href = 'css/webfont.woff.css';
// localStorage 를 지원하지 않는 브라우저를 위한 css
mytory / get_smashing_magazine_calendar.php
Last active May 9, 2016
script get smashing magazine monthly wallpaer
View get_smashing_magazine_calendar.php
* Author: An, Hyeong-woo
* Email:
* Blog:
* Description: See detail on help message. You can see by running this script without args.
* Dependencies: Tidy extension.
function cmd_echo($str){
echo $str . PHP_EOL;
mytory / download-functions.php
Created Apr 21, 2016
Download file with specific name in all browser.
View download-functions.php
* Download file from path and mimetype.
* @param $path
* @param $mimetype
* @param null $filename
function download_file ($path, $mimetype, $filename = NULL) {
if (empty($filename)) {
$filename = pathinfo($path, PATHINFO_BASENAME);
mytory / anything2html.php
Last active Mar 1, 2016
Created by [gnoownow10]( docx, doc, hwp to html.
View anything2html.php
* @see dependencies: libreoffice, pyhwp
* Class Anything2html
class Anything2html {
static $hwp5html;
static $libreoffice;
static $error;
mytory / batch_convert2utf8.php
Created Jan 7, 2016
euc-kr to utf-8. PHP detect file encoding and if encoding is euc-kr or ms949, it convert the file.
View batch_convert2utf8.php
function batch_convert_encoding($dir, $out_charset = 'utf-8'){
if($handle = opendir($dir)){
echo "\n\n## Directory is $dir\n\n";
while(false !== ($file = readdir($handle))){
if(in_array($file, array('.', '..', '.git'))){
$file_path = realpath($dir . DIRECTORY_SEPARATOR . $file);
$pathinfo = pathinfo($file_path);