Skip to content

Instantly share code, notes, and snippets.

View bombless's full-sized avatar

York Xiang bombless

  • Guangzhou, China
View GitHub Profile
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:wf="http://www.microsoft.com/schemas/webfilter/2008">
<channel>
<title>rules</title>
<description>Export of InPrivate Filtering</description>
<item><description>tiao.mxmxhaohaozhuan.com</description><wf:blockRegex><![CDATA[tiao.mxmxhaohaozhuan.com]]></wf:blockRegex></item>
</channel></rss>
@bombless
bombless / gist:4286145
Created December 14, 2012 15:13
Generate YUV color !!!
<!DOCTYPE html>
<html><body>
<script type="text/javascript">
(function(){
function genYUVColor(input){
var Y,U,V;
var R,G,B;
@bombless
bombless / gist:4286354
Created December 14, 2012 15:44
Generate YUV color !!!
<!DOCTYPE html>
<html><body>
<script type="text/javascript">
(function(){
function genYUVColor(input){
var Y,U,V;
var R,G,B;
@bombless
bombless / gist:4286412
Created December 14, 2012 15:53
genYUVColor()
function genYUVColor(input){
var Y,U,V;
var R,G,B;
Y = Math.floor(input / 65536);
U = Math.floor(input % 65536 / 256);
V = Math.floor(input % 256);
@bombless
bombless / gist:4286560
Created December 14, 2012 16:10
Python YUV2RGB & RGB2YUV
def RGB2YUV(input):
(R, G, B) = input
Y = int(0.299 * R + 0.587 * G + 0.114 * B)
U = int(-0.147 * R + -0.289 * G + 0.436 * B)
V = int(0.615 * R + -0.515 * G + -0.100 * B)
return (Y, U, V)
def YUV2RGB(input):
(Y, U, V) = input
int* return_pointer(){
return (int*)malloc(sizeof(int));
}
void modify_pointer(int **p){
*p = (int*)malloc(sizeof(int));
}
/*
* Taken from http://sower.com.au/2011/06/jquery-multilevel-accordion-in-10-lines-of-code/
*/
$(document).ready(function() {
$('.menu li ul').hide();
$('.menu li a').click(
function(evt) {
evt.preventDefault();
evt.stopPropagation();
var openMe = $(this).next();
@bombless
bombless / gist:4984274
Last active December 13, 2015 22:28
a dirty class to help using ext/mysqli
<?php
class BindParam{
private $values = array(),
$names = array(),
$types = '',
$question_marks = array(),
$table_name;
public function __construct($table){
$this->table_name = $table;
@bombless
bombless / gist:5105869
Created March 7, 2013 06:05
PHP5.3开始,ext/mysqli的mysqli_stmt::bind_param不能正确的处理双重引用下的字符串导致MySQL数据库中VARCHAR型域的值被错误的更新成"0"这个值。调这个问题调的我蛋都碎了。
<?php
/**
* ext/mysqli不像PDO支持命名的变量绑定
* 因此这里弄了个helper类来生成mysqli_stmt::bind_param所需的调用参数
* 关于ext/mysqli可参考[http://codular.com/php-mysqli]
*/
class BindParam{
private $values = array(),
$names = array(),
$types = '',
@bombless
bombless / gist:5158630
Created March 14, 2013 03:39
C99的复合常量(Compound Literals)真是太棒了!
/**
** bombless@126.com
** 2013-3-14
** 关于复合常量可参考[http://www.waikinq.com/the-c99s-new-characteristics/]
**/
#define UNICODE
#include <windows.h>
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){
switch(uMsg){
case WM_DESTROY: