This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/sh | |
soffice --headless --convert-to html:HTML "$1" | |
basename=$(basename "$1") | |
filename="${basename%.*}" | |
html2text "$filename.html" > "$filename.md" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Emulate register_globals on | |
// source: http://php.net/manual/en/faq.misc.php#faq.misc.registerglobals | |
if (!ini_get('register_globals')) { | |
$superglobals = array($_SERVER, $_ENV, | |
$_FILES, $_COOKIE, $_POST, $_GET); | |
if (isset($_SESSION)) { | |
array_unshift($superglobals, $_SESSION); | |
} | |
foreach ($superglobals as $superglobal) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Emulate register_globals off | |
// source: http://php.net/manual/en/faq.misc.php#faq.misc.registerglobals | |
function unregister_GLOBALS() | |
{ | |
if (!ini_get('register_globals')) { | |
return; | |
} | |
// Might want to change this perhaps to a nicer error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function print_file_encoding_from($dir){ | |
if($handle = opendir($dir)){ | |
echo "\n\n## Directory is $dir\n\n"; | |
while(false !== ($file = readdir($handle))){ | |
if(in_array($file, array('.', '..', '.git'))){ | |
continue; | |
} | |
$file_path = realpath($dir . DIRECTORY_SEPARATOR . $file); | |
$extension = pathinfo($file_path, PATHINFO_EXTENSION); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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'))){ | |
continue; | |
} | |
$file_path = realpath($dir . DIRECTORY_SEPARATOR . $file); | |
$pathinfo = pathinfo($file_path); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @see dependencies: libreoffice, pyhwp https://pythonhosted.org/pyhwp/ko/ | |
* Class Anything2html | |
*/ | |
class Anything2html { | |
static $hwp5html; | |
static $libreoffice; | |
static $error; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Author: An, Hyeong-woo | |
* Email: mytory@gmail.com | |
* Blog: http://mytory.net | |
* 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
"use strict"; | |
// 스매싱 매거진의 '지연된 웹폰트 불러오기' javascript를 안형우가 수정한 것. | |
// https://gist.github.com/hdragomir/8f00ce2581795fd7b1b7 | |
// 한 번 캐시하면 css 파일은 클라이언트 측에 저장한다. | |
// 아래 css_href 가 바뀌면 그 때 다시 받는다. | |
// woff base64를 내장한 css | |
var css_href = 'css/webfont.woff.css'; | |
// localStorage 를 지원하지 않는 브라우저를 위한 css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")); | |
} | |
}}); |