Skip to content

Instantly share code, notes, and snippets.

View fulicat's full-sized avatar

Jack Chan fulicat

  • Social Power Information Technology(Shanghai) Co.,Ltd.
  • Shanghai, China
View GitHub Profile
@tvandervossen
tvandervossen / gist:836355
Created February 20, 2011 22:06
Add a viewport meta element to Apache’s auto-generated index pages
Adding the following to /etc/apache2/extra/httpd-autoindex.conf makes browsing Apache’s auto-generated index pages a lot easier on an iOS device which can be handy while testing:
IndexHeadInsert "<meta name=\"viewport\" content=\"width=640,initial-scale=1\">"
@fireball2018
fireball2018 / ipLocation.php
Created May 11, 2011 12:44
IpLocation by QQWry.Dat
<?php
/**
* IP 地理位置查询类
* 用法: $ip = new IpLocation();
* var_dump($ip->getlocation("61.163.77.210"));
*/
class iplocation
{
/**
* QQWry.Dat文件指针
@maxim75
maxim75 / exif.html
Created May 19, 2011 06:03
Reading EXIF info from image with JavaScript
<!DOCTYPE html>
<html lang="en">
<head>
<title>h5</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.js"></script>
<script src="exif.js"></script>
<style>
#holder { border: 1px dashed #ccc; width: 100px; height: 100px; margin: 20px auto;}
#holder.hover { border: 1px dashed #333; }
#result .property { width: 100px; }
@mattd
mattd / gist:1006398
Created June 3, 2011 14:12
nginx try_files with a proxy_pass
server {
root /var/www/example.com/static;
server_name example.com;
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;
try_files /maintenance.html @proxy;
location @proxy {
proxy_pass http://127.0.0.1:10001;
@bdunogier
bdunogier / curl_progress.php
Created June 16, 2011 22:31
PHP/cURL download progress monitoring
<?php
file_put_contents( 'progress.txt', '' );
$targetFile = fopen( 'testfile.iso', 'w' );
$ch = curl_init( 'http://ftp.free.org/mirrors/releases.ubuntu-fr.org/11.04/ubuntu-11.04-desktop-i386-fr.iso' );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $ch, CURLOPT_NOPROGRESS, false );
curl_setopt( $ch, CURLOPT_PROGRESSFUNCTION, 'progressCallback' );
curl_setopt( $ch, CURLOPT_FILE, $targetFile );
@tkihira
tkihira / gist:2367067
Created April 12, 2012 13:02
rmdir recursively in node.js
var fs = require("fs");
var path = require("path");
var rmdir = function(dir) {
var list = fs.readdirSync(dir);
for(var i = 0; i < list.length; i++) {
var filename = path.join(dir, list[i]);
var stat = fs.statSync(filename);
if(filename == "." || filename == "..") {
@ayanamist
ayanamist / shExpMatch.js
Created June 25, 2012 16:11
Better implementation of shExpMatch
function shExpMatch(url, pattern) {
var pCharCode;
var isAggressive = false;
var pIndex;
var urlIndex = 0;
var lastIndex;
var patternLength = pattern.length;
var urlLength = url.length;
for (pIndex = 0; pIndex < patternLength; pIndex += 1) {
pCharCode = pattern.charCodeAt(pIndex); // use charCodeAt for performance, see http://jsperf.com/charat-charcodeat-brackets
@hiscaler
hiscaler / vbs-replace-file-contents.vbs
Created July 12, 2012 03:28
VBScript Replace file contents
Dim filePath, fileContents, dFileContents
filePath = "C:\"
' 查找所有 .lst 扩展名文件
Dim fs, f, array1, f1
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder("C:\")
Set fc = f.Files
For Each f1 in fc
@CWSpear
CWSpear / object_merge.php
Created September 18, 2012 19:11
object_merge for php
<?php
$one->one = 1;
$two->two->one = 21;
$two->two->two = 22;
$three->two->one = 31;
$return_obj = object_merge($one, $two, $three);
// returns:
// Array
<?php
$one->one = 1;
$two->two->one = 21;
$two->two->two = 22;
$three->two->one = 31;
$return_obj = object_merge($one, $two, $three);
// returns:
// Array