Skip to content

Instantly share code, notes, and snippets.

{"sig":"a062442c0a6d5da0bc5018953b5e38616df76d28590700385dcfb6370c6e91082434bd4268275de8621a0cfe9fbf2ae354bd55fe3a5d60fc1d97d250d47fdba90","msghash":"0640abea1d2cf0115a6db072f6e319ad381d7b8cd3f3a34d8bf664b5a55c4a57"}

Keybase proof

I hereby claim:

  • I am quasimo on github.
  • I am linz (https://keybase.io/linz) on keybase.
  • I have a public key ASD4lcJqcgRqPQdNaQSAtjqJHI68LJMuOp4ggmVZwGqzewo

To claim this, I am signing this object:

[
{
name:"HTML5",
uri:"http://www.w3.org/TR/html5/single-page.html",
category:"markup"
},
{
name:"HTML 5.1",
uri:"http://www.w3.org/TR/html51/single-page.html",
category:"markup"
@Quasimo
Quasimo / gist:4969937
Created February 17, 2013 03:18
WordPress加密文章可搜索的方法
add_filter( 'posts_search', 'include_password_posts_in_search' );
function include_password_posts_in_search( $search ) {
global $wpdb;
if( !is_user_logged_in() ) {
$pattern = " AND ({$wpdb->prefix}posts.post_password = '')";
$search = str_replace( $pattern, '', $search );
}
return $search;
}
@Quasimo
Quasimo / wp-oddeven
Created January 18, 2013 05:17
add to functions.php in wordpress theme. Add Odd/Even to Posts with post_class() http://wp-snippets.com/add-oddeven-to-posts/
<?php
function oddeven_post_class ( $classes ) {
global $current_class;
$classes[] = $current_class;
$current_class = ($current_class == 'odd') ? 'even' : 'odd';
return $classes;
}
add_filter ( 'post_class' , 'oddeven_post_class' );
global $current_class;
$current_class = 'odd';
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.country {
fill: #b8b8b8;
stroke: #fff;
stroke-width: .5px;
stroke-linejoin: round;
}
-- Created By AudialRedux (c) 2011
-- v1.0
tell application "Finder"
set diskName to (name of startup disk)
set diskSpace to (free space of startup disk)
--(*Number of bytes free.*)
set diskSpace to (round (diskSpace * 1048576))
(*Changes bytes into megabytes.*)
set diskCap to (capacity of startup disk)
@Quasimo
Quasimo / image2css
Created October 5, 2012 06:56
Pure CSS Mona Lisa
This file has been truncated, but you can view the full file.
<!doctype html>
<html>
<head>
<style>
#monalisa {
width:0;
height:0;
box-shadow:
# auto convert imgur.com links to image tags
def imgur(value):
imgs = re.findall('(http://imgur.com/[a-zA-Z0-9\/]+)\s?', value)
if (len(imgs) > 0):
for img in imgs:
img_id = re.findall('http://imgur.com/([a-zA-Z0-9\/]+)', img)
if (img_id[0] != ''):
value = value.replace('http://imgur.com/' + img_id[0], '<a href="http://imgur.com/' + img_id[0] + '" target="_blank"><img src="http://i.imgur.com/' + img_id[0] + '.jpg" class="imgly" border="0" /></a>')
return value
else:
function hexToCMYK (hex) {
var computedC = 0;
var computedM = 0;
var computedY = 0;
var computedK = 0;
hex = (hex.charAt(0)=="#") ? hex.substring(1,7) : hex;
if (hex.length != 6) {
alert ('Invalid length of the input hex value!');