Skip to content

Instantly share code, notes, and snippets.

@minwe
minwe / response.php
Created June 10, 2014 05:50
json-api/singletons/response.php
<?php
class JSON_API_Response {
function setup() {
global $json_api;
$this->include_values = array();
$this->exclude_values = array();
if ($json_api->query->include) {
$this->include_values = explode(',', $json_api->query->include);
}
@minwe
minwe / json-api_singletons_api.php
Created June 10, 2014 05:49
json-api/singletons/
<?php
class JSON_API {
function __construct() {
$this->query = new JSON_API_Query();
$this->introspector = new JSON_API_Introspector();
$this->response = new JSON_API_Response();
add_action('template_redirect', array(&$this, 'template_redirect'));
add_action('admin_menu', array(&$this, 'admin_menu'));
@minwe
minwe / define.php
Created June 10, 2014 05:36 — forked from KATT/define.php
<?php
/**
* Check if content is JSON
*
* @param string $content
* @return boolean
*/
function w3_is_json($content) {
return json_decode($content) !== NULL;
}
@minwe
minwe / is360se.js
Created May 22, 2014 02:27
360 浏览器检测
// 来自 http://se.360.cn/common/qihoo_ie6_tips.js
function is360se() {
var ret = false;
ua = navigator.userAgent.toLowerCase();
if (ua.indexOf("chrome") > -1) {
ret = (ua.indexOf("qqbrowser") > -1 || ua.indexOf(" se ") > -1 || ua.indexOf("360ee") == -1) ? false : true
}
try {
if (window.external && window.external.twGetRunPath) {
html{
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
-o-filter: grayscale(100%);
filter: grayscale(100%);
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale");
filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
}
/**
* @author alteredq / http://alteredqualia.com/
* @author mr.doob / http://mrdoob.com/
*/
Detector = {
canvas : !! window.CanvasRenderingContext2D,
webgl : ( function () { try { return !! window.WebGLRenderingContext && !! document.createElement( 'canvas' ).getContext( 'experimental-webgl' ); } catch( e ) { return false; } } )(),
workers : !! window.Worker,
/*
<span>Loading</span>
<span class="l-1"></span>
<span class="l-2"></span>
<span class="l-3"></span>
<span class="l-4"></span>
<span class="l-5"></span>
<span class="l-6"></span>
*/
body {
body {
font-family: Lucida Grande, Helvetica Neue, Helvetica, Arial, sans-serif;
text-align: center;
margin-top: 20px;
font-size: 14px;
color: #333;
}
span {
display: block;
var prefix = (/mozilla/.test(navigator.userAgent.toLowerCase()) &&
!/webkit/.test(navigator.userAgent.toLowerCase())) ? '-moz-' :
(/webkit/.test(navigator.userAgent.toLowerCase())) ? '-webkit-' :
(/msie/.test(navigator.userAgent.toLowerCase())) ? '-ms-' :
(/opera/.test(navigator.userAgent.toLowerCase())) ? '-o-' : '';
sudo dtrace -n 'syscall::open*:entry { printf("%s %s",execname,copyinstr(arg0));