Skip to content

Instantly share code, notes, and snippets.

View kulamochi's full-sized avatar

Masanori Kuramochi kulamochi

View GitHub Profile
@aderowbotham
aderowbotham / php_argv_environment.php
Created November 25, 2012 17:37
PHP / Codeigniter - set environment when running in CLI mode
<?php
# in public_html/index.php
/*
* Where your CodeIgniter ENVIRONMENT is normally defined by the server environment
* variables, and assuming your database settings are automatically set based on
* that environment, this causes a problem when running the application through
* PHP on the command line e.g. in order to run CodeIgniter Migrations
*
@kijtra
kijtra / strip_tags.sql
Created July 9, 2012 07:11
[MySQL] PHPでいうstrip_tags()関数
DELIMITER //
DROP FUNCTION IF EXISTS `STRIP_TAGS`//
CREATE FUNCTION STRIP_TAGS( x longtext) RETURNS longtext
LANGUAGE SQL NOT DETERMINISTIC READS SQL DATA
BEGIN
DECLARE sstart INT UNSIGNED;
DECLARE ends INT UNSIGNED;
IF x IS NOT NULL THEN
SET sstart = LOCATE('<', x, 1);