Skip to content

Instantly share code, notes, and snippets.

@mytory
mytory / Dockerfile
Created August 7, 2018 13:00
Dockerfile basic template for Korean ubuntu user.
FROM ubuntu:18.04
ENV DEBIAN_FRONTEND=noninteractive
# repository
RUN sed -i 's|archive.ubuntu.com|mirror.kakao.com|g' /etc/apt/sources.list
RUN apt-get update
RUN apt-get upgrade -y
# timezone
@mytory
mytory / short-open-tag-converter.php
Last active September 30, 2018 09:42
Change short open tag to long open tag.
<?php
// This script convert short open tag to long open tag.
// Inspired from https://stackoverflow.com/a/3621669
//
// Source: https://gist.github.com/mytory/5380b6a970ed4c14e16dd1be498e0919
// 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
mytory / php_apache_homebrew.md
Created October 11, 2018 13:14 — forked from DragonBe/php_apache_homebrew.md
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
mytory / duplicate_line_xcode.md
Created April 8, 2019 15:51 — forked from emotality/duplicate_line_xcode.md
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
/Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources/
$fileName = 'Billing-Summary.csv';
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header('Content-Description: File Transfer');
header("Content-type: text/csv");
header("Content-Disposition: attachment; filename={$fileName}");
header("Expires: 0");
header("Pragma: public");
$fh = @fopen( 'php://output', 'w' );
@mytory
mytory / make-url-clickable-without-a-tag.php
Last active October 19, 2021 13:13
URL을 링크로 바꿔 주는데, 이미 링크가 걸린 a 태그는 건드리지 않는다.
<?php
/**
* 아래는 참고한 자료.
* @link https://stackoverflow.com/questions/24651869/regex-matching-links-without-a-tag/24653720?stw=2#24653720
*/
function make_link_clickable($text)
{
return preg_replace(
'!<a(.|\n)*?</a>(*SKIP)(*F)|' //skip a tag
. '(((f|ht)tp(s)?://)[-a-zA-Zа-яА-Я()0-9@:%_+.~#?&;/=]+)!i',