Skip to content

Instantly share code, notes, and snippets.

http://blog.roodo.com/waking_life/archives/5676961.html
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
@Barneybook
Barneybook / gist:2755088
Created May 20, 2012 06:12
php fileupload 20120520
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
照片上傳:<input name="userfile" type="file">
---------------------------------------------------------------------------------------
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Big5">
<form action="receive.php" form enctype="multipart/form-data" method=POST>
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
照片上傳:<input name="userfile" type="file">
<hr />
<input type="submit" value="送出" name="B1">
<input type="reset" value="清空" name="B2"><br/>
</form>
<?php
@Barneybook
Barneybook / .htaccess
Created May 28, 2012 06:23
.htaccess setting
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|index\.html|images|external|image|ui|themes|css|js|robots\.txt)
RewriteRule ^(.*)$ /admin/index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
@Barneybook
Barneybook / index.php
Created May 29, 2012 04:30
$_SERVER ref
<? echo $_SERVER['HTTP_HOST'];?>
<? echo $_SERVER['SERVER_NAME'];?>
@Barneybook
Barneybook / bot.php
Created June 5, 2012 04:40
bot php file
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, "haplay.no-ip.org/haplay/");
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_USERAGENT, "Google Bot");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$output = curl_exec($ch);
curl_close($ch);
echo $output;
@Barneybook
Barneybook / map.js
Created June 14, 2012 07:06
Titanium
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
var defaultDelta = 0.01;
var win1 = Titanium.UI.createWindow({
title:'map',
backgroundColor:'#fff',
fullscreen: true,
exitOnClose: true
@Barneybook
Barneybook / display.js
Created June 15, 2012 13:42
Titanium Display
Ti.API.info('Ti.Platform.displayCaps.density: ' + Ti.Platform.displayCaps.density);
Ti.API.info('Ti.Platform.displayCaps.dpi: ' + Ti.Platform.displayCaps.dpi);
Ti.API.info('Ti.Platform.displayCaps.platformHeight: ' + Ti.Platform.displayCaps.platformHeight);
Ti.API.info('Ti.Platform.displayCaps.platformWidth: ' + Ti.Platform.displayCaps.platformWidth);
if(Ti.Platform.osname === 'android'){
Ti.API.info('Ti.Platform.displayCaps.xdpi: ' + Ti.Platform.displayCaps.xdpi);
Ti.API.info('Ti.Platform.displayCaps.ydpi: ' + Ti.Platform.displayCaps.ydpi);
Ti.API.info('Ti.Platform.displayCaps.logicalDensityFactor: ' + Ti.Platform.displayCaps.logicalDensityFactor);
}
@Barneybook
Barneybook / qrscan.js
Created July 11, 2012 08:09 — forked from billdawson/qrscan.js
QR Code Scan Example from Marshall's "Developing Native Android Apps with Titanium" Webinar
qrScanButton.addEventListener("click", function(e) {
var intent = Ti.Android.createIntent({
action: "com.google.zxing.client.android.SCAN"
});
intent.putExtra("SCAN_MODE", "QR_SCAN_MODE");
var activity = Ti.Android.currentActivity;
activity.startActivityForResult(intent, function(e) {
if (e.resultCode == Ti.Android.RESULT_OK) {
var contents = e.intent.getStringExtra("SCAN_RESULT");
var format = e.intent.getStringExtra("SCAN_RESULT_FORMAT");
@Barneybook
Barneybook / simple_dom_parser_code.php
Created August 23, 2012 02:38 — forked from thephpx/simple_dom_parser_code
sample code for simple dom parser in codeigniter
$this->load->library('simple_html_dom');
$raw = file_get_html('http://faisalbd.com');
foreach($raw->find('a') as $element){
echo $element->href . '<br>';
}
//http://simplehtmldom.sourceforge.net/