Skip to content

Instantly share code, notes, and snippets.

Hello World!

Hi girvan

Hello World!
  • US
View GitHub Profile
View gist:9317639
<meta name="viewport" id="viewport" />
<script>
var viewport_width = 400;
(function(target_width){
var device_width = screen.width || 320,
ratio = (device_width/target_width);
// desktop or some old mobile browser
if(device_width > 414 || device_width < 320)
ratio = 1.0;
document.getElementById('viewport').content = "width=device-width,user-scalable=1,initial-scale=" + ratio;
View gist:9478301
(function(w, ua){
if(ua.indexOf('Android') > -1 && ua.indexOf('Chrome') ==-1)
return;
$("body").css('min-height', Math.ceil(
$(document).width() * ($(w).height()/$(w).width())
));
})(window, navigator.userAgent);
View gist:10538902
  🌻🌻
 🌻🌻🌻
🌻🌻🌻🌻 來畫個台灣吧
🌻🌻🌻🌻
🌻🌻🌻🌻
 🌻🌻
  🌻
工具 ➡ http://tw.piliapp.com/facebook-symbols/?ref=fb
View gist:51daa6dea84f41e29042
tinypng() {
for f in *.png
do
cmd="curl -s --user api:YOUR_API_KEY --data-binary @$f https://api.tinypng.com/shrink | sed 's/.*https/https/g' | sed 's/\.png.*/.png/g' | xargs curl -s -o $f"
eval "$cmd";
done
}
View php-fpm-cli
#!/bin/bash
#
# The MIT License (MIT)
#
# Copyright (c) 2014 Mathias Leppich <mleppich@muhqu.de>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
View nginx.conf
root /home/wwwroot;
+ error_page 500 502 503 504 /static/500.html;
View 500.html
<!DOCTYPE html>
<html>
<meta charset="utf-8" />
<style type="text/css">
#main { font-family: arial; font-size:18px; }
#time { position:fixed; bottom:5px; right:5px; color:lightgray;}
</style>
<body>
<span id="time"></span>
<span id="main">Loading<span id="dot">.</span></span>
@girvan
girvan / preload.inc.php
Last active Aug 29, 2015
dbchecker file
View preload.inc.php
<?php
if(is_file('/home/wwwroot/dbchecker'))
require LIB_PATH . '/database/checker.php';
View dbchecker.php
<?php
$mysql_checker = function(){
$cfg = explode("\t", DB_CFG);
error_reporting(E_ERROR);
$try_num = 20;
$try_interval = 500000; // 0.5 sec
foreach(range(0, $try_num) as $times)
{
@girvan
girvan / lite__init__.py
Created Aug 28, 2011
你覺的第18行這樣子寫如何?
View lite__init__.py
import sys
import types
import os
import urllib
import cgi
import logging
from Cookie import SimpleCookie
# instance
_liter = None
You can’t perform that action at this time.