Skip to content

Instantly share code, notes, and snippets.

@chobie
chobie / markdown.patch
Created April 21, 2012 07:48
KwattroMarkdownBundle patch
diff --git a/Tests/Markdown/KwattroMarkdownTest.php b/Tests/Markdown/KwattroMarkdownTest.php
index e21b152..0162ec2 100644
--- a/Tests/Markdown/KwattroMarkdownTest.php
+++ b/Tests/Markdown/KwattroMarkdownTest.php
@@ -64,12 +64,12 @@ class KwattroMarkdownTest extends \PHPUnit_Framework_TestCase
$md = new Markdown(array(), array(), 'html');
$link = "hello_world_man";
$expected = '<p>'.$link.'</p>'."\n";
- //$this->assertEquals($expected, $md->render($link, array('no_intraemphasis' => true)));
+ //$this->assertEquals($expected, $md->render($link, array('no_intra_emphasis' => true)));
@chobie
chobie / gist:2416534
Created April 18, 2012 21:04
installing php-git
sudo aptitude install build-essential automake cmake patch git-core php5-cli php5-dev libpcre3-dev -y
git clone https://github.com/libgit2/libgit2.git
cd libgit2
mkdir build
cd build
cmake ..
cmake --build .
sudo cmake --build . --target install
cd ../../
@chobie
chobie / gist:1702426
Created January 30, 2012 04:08
read_property: what's wrong?
diff --git a/repository.c b/repository.c
index 88cc2bf..411f15d 100644
--- a/repository.c
+++ b/repository.c
@@ -28,6 +28,30 @@ PHPAPI zend_class_entry *git2_repository_class_entry;
void php_git2_repository_init(TSRMLS_D);
static zend_object_handlers git2_repository_object_handlers;
+
+static zval *php_git2_repository_read_property(zval *object, zval *member, int type TSRMLS_DC)
module Fluent
require 'pp'
# help me! i'm really ruby newbiee
require '/usr/local/lib/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluent-0.9.20/lib/fluent/plugin/memcache_parser'
class MemcachedInput < Input
Plugin.register_input('memcached', self)
def initialize
@chobie
chobie / gist:1279760
Created October 11, 2011 23:12
php fwrite implementation
// from php 5.3.6
PHPAPI size_t _php_stream_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC);
#define php_stream_write_string(stream, str) _php_stream_write(stream, str, strlen(str) TSRMLS_CC)
#define php_stream_write(stream, buf, count) _php_stream_write(stream, (buf), (count) TSRMLS_CC)
PHPAPI size_t _php_stream_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
{
if (buf == NULL || count == 0 || stream->ops->write == NULL) {
@chobie
chobie / gist:1146789
Created August 15, 2011 13:47
for testing php-5.3.4a3 built-in server behavior
<?php
header("Content-type: text/plain");
$data = file_get_contents("http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js");
header("Content-length: ". strlen($data));
echo $data;
@chobie
chobie / gist:1092690
Created July 19, 2011 15:04
chobie's git svn externals
#!/usr/local/Cellar/php/5.3.6/bin/php
<?php
/*
git svn externals
git svn checkout-externals
git svn update-externals
git svn remove-externals
.externalsにデータはいれておく。
*/
/*!
* jQuery JavaScript Library v1.5.1
* http://jquery.com/
*
* Copyright 2011, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
# git リポジトリ内でそれっぽいディレクトリ名に移動する
function j()
{
top_dir=`git rev-parse --show-cdup`
path=`git ls-tree -rd --name-only --full-tree $(git rev-parse HEAD) | grep ${1}$`
result=$?
if [ ${result} -eq 0 ]; then
echo "# jumping to [${path}]";
cd ${top_dir}${path}

cat git object.

cat .git/objects/dd/f452dc1825ed7b0dca08b9a322174b3394644d  | php -r 'echo gzuncompress(stream_get_contents(fopen("php://stdin","r")));'