Skip to content

Instantly share code, notes, and snippets.

⚡️
Hello World!

Hi girvan

⚡️
Hello World!
  • US
Block or report user

Report or block girvan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@girvan
girvan / CDN_benchmark.md
Last active Oct 18, 2015
Cloudflare vs Cloudfront vs no CDN(US West) for each country
View CDN_benchmark.md

blog post: http://dev.sopili.net/2015/10/css-cloudfront-cloudflare-no-cdn.html

| TW | US | HK | SG | KR | BR | IN | JP | FR | GB | DE | RU ----|----|----|----|----|---|----|----|----|----|---|----|----|----|--- no CDN | 502 | 591 | 619 | 309 | 807 | 1118 | 11726 | 382 | 699 | 419 | 544 | 809 Cloudflare | 749 | 773 | 716 | 376 | 697 | 1363 | 1682 | 581 | 666 | 500 | 606 | 964 Cloudfront | 644 | 887 | 288 | 472 | 375 | 1524 | 1723 | 399 | 630 | 690 | 590 | 765

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 / 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 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>
View nginx.conf
root /home/wwwroot;
+ error_page 500 502 503 504 /static/500.html;
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 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
}
@girvan
girvan / ga_link_event
Last active Sep 14, 2016
ga_link_event
View ga_link_event
View gist:10538902
  🌻🌻
 🌻🌻🌻
🌻🌻🌻🌻 來畫個台灣吧
🌻🌻🌻🌻
🌻🌻🌻🌻
 🌻🌻
  🌻
工具 ➡ http://tw.piliapp.com/facebook-symbols/?ref=fb
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);
You can’t perform that action at this time.