Skip to content

Instantly share code, notes, and snippets.

View outman's full-sized avatar
💭
I may be slow to respond.

outman

💭
I may be slow to respond.
  • Beijing, China
View GitHub Profile
@outman
outman / 12306AutoSubmit.user.js
Created January 9, 2012 07:49 — forked from kevintop/12306AutoSubmit.user.js
12306 Auto Submit
/*
12306 Auto Submit => A javascript snippet to help you auto submit.
Copyright (C) 2011 Kevintop
Includes jQuery
Copyright 2011, John Resig
Dual licensed under the MIT or GPL Version 2 licenses.
http://jquery.org/license
Includes 12306.user.js
@outman
outman / export_image_to_excel
Created August 3, 2012 01:02
Exprot Online Image to Excel by PHPExcel
<?php
require_once __DIR__ . '/PHPExcel/Classes/PHPExcel.php';
$objPHPExcel = new PHPExcel();
// imagecreatefromXXX (XXX is jpeg png or gif)
$gdImage = imagecreatefromjpeg('http://678bt.com/PHPExcel/Tests/images/officelogo.jpg');
$objDrawing = new PHPExcel_Worksheet_MemoryDrawing();
@outman
outman / CSV_Exoprt
Created September 1, 2012 16:43
Export CSV Class
<?php
/**
* Base ON Zhen.liu's SourceCode
* Add isset function for user agent
* Change line end
*/
class CSV {
@outman
outman / codeigniter_rewrite_for_nginx
Created September 12, 2012 13:56
nginx for CodeIgniter rewrite
server {
listen 80;
server_name mrkt.com;
access_log /var/www/html/logs/mrkt.access.log main;
error_log /var/www/html/logs/mrkt.error.log;
location / {
root /var/www/html/mrkt;
index index.html index.htm index.php;
@outman
outman / split_chinese_by_space
Created September 13, 2012 09:20
Split Chinese String By Space To A New
$cn_string_split_by_space = implode(" ", preg_split('//u', "中文字符串", -1, PREG_SPLIT_NO_EMPTY));
@outman
outman / phpexcel_style_and_data
Created September 21, 2012 07:14
phpexcel set border
// set border
$sheet->getStyle("A1:I{$offset}")->applyFromArray(array(
'borders' => array(
'allborders' => array(
'style' => PHPExcel_Style_Border::BORDER_THIN
)
)
));
@outman
outman / phpexcel_data_for_phpmailer
Created September 21, 2012 07:17
phpexcel for phpmailer
// get the content
@ob_start();
$writer = PHPExcel_IOFactory::createWriter($excel, "Excel2007");
$writer->save("php://output");
$data = @ob_get_contents();
@ob_end_clean();
// set email attachment
@outman
outman / site domain
Created October 18, 2012 06:20
site domain
class Util {
static function domain($output = true) {
$protocol = strpos(strtolower($_SERVER['SERVER_PROTOCOL']),'https');
$host = $_SERVER["HTTP_HOST"];
$port = $_SERVER["SERVER_PORT"];
$domain = (($protocol !== false) ? "https" : "http") . "://" . $host;
$domain .= ($port == "80") ? "" : (":" . $port);
@outman
outman / zendframework2moduleroute
Created November 25, 2012 11:06
ZendFramework2 route for new module by segment
return array(
'controllers' => array(
'invokables' => array(
'Admin\Controller\Index' => 'Admin\Controller\IndexController',
'Admin\Controller\Dash' => 'Admin\Controller\DashController',
),
),
'router' => array(
@outman
outman / backtotop
Created November 26, 2012 01:25
back to top
$(document).ready(function(){
$("#back-top").hide();
$(function () {
$(window).scroll(function () {
if ($(this).scrollTop() > 100) {
$('#back-top').fadeIn();
} else {
$('#back-top').fadeOut();
}