Skip to content

Instantly share code, notes, and snippets.

<?php
function detect() {
$userAgent = strtolower($_SERVER['HTTP_USER_AGENT']);
// Identify the browser. Check Opera and Safari first in case of spoof. Let Google Chrome be identified as Safari.
if (preg_match('/opera/', $userAgent)) {
$name = 'opera';
}
elseif (preg_match('/webkit/', $userAgent)) {
$name = 'safari';
@xain
xain / rails_admin.zh-CN.yml
Created August 5, 2012 07:27
rails_admin.zh-CN.yml
zh-CN:
admin:
home:
name: "首页"
pagination:
previous: "&laquo; 上一页"
next: "下一页 &raquo;"
truncate: "…"
misc:
filter_date_format: "mm/dd/yy" # a combination of 'dd', 'mm' and 'yy' with any delimiter. No other interpolation will be done!
@quietlynn
quietlynn / gplus.quick_mention.user.js
Created July 1, 2012 13:10
Google+ Quick Mention => Mention G+ users quickly.
/*
Google+ Quick Mention => Mention G+ users quickly.
Copyright (C) 2012 Jingqin Lynn
Includes jQuery
Copyright 2011, John Resig
Dual licensed under the MIT or GPL Version 2 licenses.
http://jquery.org/license
Includes Sizzle.js