Skip to content

Instantly share code, notes, and snippets.

@DragonBe
DragonBe / php_apache_homebrew.md
Last active July 4, 2024 17:15
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.

@emotality
emotality / duplicate_line_xcode.md
Last active April 6, 2024 04:23
Xcode - Duplicate Line key binding

NOTE (2022-07-09): Xcode finally added this functionality in Xcode 14, please see release notes here:

New Features in Xcode 14 Beta 3
When editing code, the Edit > Duplicate menu item and its corresponding keyboard shortcut now duplicate the selected text — or the line that currently contains the insertion point, if no text is selected. (8614499) (FB5618491)


Xcode line duplicate

Bind keys to duplicate lines in Xcode

@mytory
mytory / anything2html.php
Last active March 1, 2016 10:51
Created by [gnoownow10](https://github.com/gnoownow10). docx, doc, hwp to html.
<?php
/**
* @see dependencies: libreoffice, pyhwp https://pythonhosted.org/pyhwp/ko/
* Class Anything2html
*/
class Anything2html {
static $hwp5html;
static $libreoffice;
static $error;
@hasinhayder
hasinhayder / fetch-attachment.js
Last active January 23, 2018 06:00
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"));
}
}});
@peterjaap
peterjaap / fixtags.php
Last active February 7, 2021 22:22
Replace PHP short open tags with long form open tags - PHP script version. Slightly adapted from https://github.com/danorton/php_replace_short_tags -- usage; find . -type f -iname "*.phtml" | xargs php -d short_open_tag=On fixtags.php --overwrite
#!php-cli
<?php
/**
* php_replace_short_tags
* Copyright © 2010 Weirdmasters, Austin, Texas
*
* License:
* CC-BY-SA v3.0
* http://creativecommons.org/licenses/by-sa/3.0/
*
@sooop
sooop / hangulSound.js
Created February 15, 2013 06:48
한글 초/중/종성을 구하는 자바스크립트 함수
/**
초성 중성 종성 분리 하기
유니코드 한글은 0xAC00 으로부터
초성 19개, 중상21개, 종성28개로 이루어지고
이들을 조합한 11,172개의 문자를 갖는다.
한글코드의 값 = ((초성 * 21) + 중성) * 28 + 종성 + 0xAC00
(0xAC00은 'ㄱ'의 코드값)
@vrushank-snippets
vrushank-snippets / PHP : Array To CSV - Download CSV File
Created December 13, 2012 06:21
PHP : Array To CSV - Download CSV File
$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' );
@jed
jed / LICENSE.txt
Created May 20, 2011 13:27 — forked from 140bytes/LICENSE.txt
generate random UUIDs
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE