Skip to content

Instantly share code, notes, and snippets.

$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 / 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/
@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 / fetch-attachment.js
Created August 18, 2016 15:53 — forked from hasinhayder/fetch-attachment.js
Fetch WordPress Media Files (Attachments) Via Backbone Model
var attachment_id = 1234;
var attachment = new wp.media.model.Attachment.get(attachment_id);
attachment.fetch({success:function(att){
if (_.contains(['png','jpg','gif','jpeg'],att.get('subtype'))) {
console.log(att.attributes);
$("<img/>").attr("src",att.attributes.sizes.thumbnail.url).appendTo($("body"));
}
}});
/**
초성 중성 종성 분리 하기
유니코드 한글은 0xAC00 으로부터
초성 19개, 중상21개, 종성28개로 이루어지고
이들을 조합한 11,172개의 문자를 갖는다.
한글코드의 값 = ((초성 * 21) + 중성) * 28 + 종성 + 0xAC00
(0xAC00은 'ㄱ'의 코드값)
/**
초성 중성 종성 분리 하기
유니코드 한글은 0xAC00 으로부터
초성 19개, 중상21개, 종성28개로 이루어지고
이들을 조합한 11,172개의 문자를 갖는다.
한글코드의 값 = ((초성 * 21) + 중성) * 28 + 종성 + 0xAC00
(0xAC00은 'ㄱ'의 코드값)