Skip to content

Instantly share code, notes, and snippets.

View girvan's full-sized avatar
Hello World!

Hi girvan

Hello World!
View GitHub Profile
<html>
<head>
</head>
<body>
<img src="http://pics.blog.yam.com/badimage.jpg" />
<script>
function hi(){
var i=new Image();
i.onerror=function(){alert('error and do something');};
i.src="http://pics.blog.yam.com/badimage.jpg";
{
list: "<ul><li><pre><span class="cursor focus">●</span> 15{1}{4}{14}?{5}{2} 3/21 {10}中央社{8} {11}{9}{14}"{12}{6}{13}{3}{4}{14}?{5}"{6}>連勝文遭槍擊案 地院5月宣判{8}{8} {7}
{0} 16{1}{4}{15}?{5}{2} 3/21 {10}中廣新聞網 {11}{9}{15}"{12}{6}{13}{3}{4}{15}?{5}"{6}>廣告不實標示錯誤 中興保全遭罰90萬{8} {7}
{0} 17{1}{4}{16}?{5}{2} 3/21 {10}中央社{8} {11}{9}{16}"{12}{6}{13}{3}{4}{16}?{5}"{6}>馬總統:TIFA卡在美牛問題{8}{8}{8}{7}
{0} 18{1}{4}{17}?{5}{2} 3/21 {10}中央社{8} {11}{9}{17}"{12}{6}{13}{3}{4}{17}?{5}"{6}>博鰲:台灣競爭力亞洲第2{8}{8}{8} {7}
{0} 19{1}{4}{18}?{5}{2} 3/21 {10}中廣新聞網 {11}{9}{18}"{12}{6}{13}{3}{4}{18}?{5}"{6}>油電人事成本太高? 施顏祥:燃料才最高{8} {7}
{0} 20{1}{4}{19}?{5}{2} 3/21 {10}NOWnews{8} {11}{9}{19}"{12}{6}{13}{3}{4}{19}?{5}"{6}>女神卡卡一票難求 驚爆內線偷跑?{8}{8}{7}
{0} 21{1}{4}{20}?{5}{2} 3/21 {10}中央社{8} {11}{9}{20}"{12}{6}{13}{3}{4}{20}?{5}"{6}>昶昕:未賣硫酸銅給飼料商{8}{8}{8}{7}
{0} 22{1}{4}{21}?{5}{2} 3/21 {10}中央社{8} {11}{9}{21}"{12}{6}{13}{3}{4}{21}?{5}"{6}>免試入學 方文山:別擔心太多{8}{8} {7}
{0} 23{1}{4}{22}?{5}{2} 3/21 {10}路透社{8} {11}{9}{22}"{
@girvan
girvan / gist:2155315
Created March 22, 2012 02:54
把下面這一段貼到bashrc裡面即可
function wtitle(){ echo -ne "\033]0; $@ \007"; }
@girvan
girvan / fetch-content-by-using-gae.py
Created March 22, 2012 03:03
到shell.appspot.com,然後執行下列指令即可
from google.appengine.api import urlfetch
result = urlfetch.fetch("http://software.sopili.net/")
result.content
function htmlhex_decode($str){
if(preg_match_all("/&#(\d+);/",$str,$match)){
foreach($match[1] as $key=>$value){
$str=str_replace($match[0][$key],"\u".dechex($value),$str);
}
}
$str=preg_replace("/&#x(\d+);/","\\u$1",$str);
$str=str_replace(Array("\r","\n"),Array("\\r","\\n"),$str);
function big52utf8($big5str) {
$blen = strlen($big5str);
$utf8str = "";
for($i=0; $i<$blen; $i++) {
$sbit = ord(substr($big5str, $i, 1));
//echo $sbit;
//echo "<br>";
if ($sbit < 129) {
//一開始總是必要的
require '/home/www/config.php';
//或是這樣
require '../config.php'; //但這樣子在crontab不能跑
//當然,接下來的路徑就使用變數或常數來寫程式
require SOPILI_PATH.'/lib/db_connection.php';
<?php
$url_arr=Array('software'=>'software.sopili.net','dev'=>'dev.sopili.net');
foreach($url_arr as $key=>$value){
echo $key."<br>"; //重點是 key,有時候非常的需要key這個值,然後是字串型態
}
<?php
//宣告
var url_arr={'software':'software.sopili.net','dev':'dev.sopili.net'};
//讀取
for(var key in url_arr){
//這裡面的key值,就真的是字串了!
document.write(url_arr[key]+'<br>');
}
<input type='button' onclick="window.location.href='http://tools.sopili.net/';" value='執行' />