Skip to content

Instantly share code, notes, and snippets.

/**
* #test retrieveBy
* <code>
* #ok($t = TagPeer::retrieveBy('slug', 'culture'));
* #is($t->getSlug(), 'culture');
* #is($t = TagPeer::retrieveBy('slug', 'culturecult23') ,NULL);
* </code>
*/
public static function getCriteria($c=null)
{
#!/bin/sh
if [ "x$1"="x" ]; then
target=""
else
target=$1
fi
echo "running doctest $1....\n\n";
@sousk
sousk / gist:243778
Created November 27, 2009 02:05
install imagemagick on Mac OSX
# install imagemagick on OSX
$ sudo port install ImageMagick
$ pecl download imagick
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading imagick-2.3.0.tgz ...
Starting to download imagick-2.3.0.tgz (86,976 bytes)
.....................done: 86,976 bytes
File /Users/tumf/tmp/imagick-2.3.0.tgz downloaded
/Users/tumf/tmp%
$ tar xvzf imagick-2.3.0.tgz
@sousk
sousk / gist:306424
Created February 17, 2010 08:12
a simple Q4M wrapper for Propel/PHP. note that this scripts has no care about query injection
<?php
/**
*
*/
class Q4M
{
public static $owned_tables = array();
public static $con = null;
const Q4M_SELECT = "select * from %s where queue_wait('%s')";
@sousk
sousk / gist:306425
Created February 17, 2010 08:13
a simple MySQL Profiler wrapper for Propel/PHP. stop while writing. i uploaded this for later.
<?php
/**
* A propel wrapper for mysql profiling tool
* see http://dev.mysql.com/tech-resources/articles/mysql_51_diagnostic_tools.html
*/
class PropelMysqlProfiler
{
protected $con;
public $default_keys = array(
'query_id',
@sousk
sousk / jquery.easing.1.3.js
Created February 22, 2010 03:28 — forked from cho45/sample3.html
animation demo script with jsdeffered described at http://subtech.g.hatena.ne.jp/cho45/20100221/1266758781
/*
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
*
* Uses the built in easing capabilities added In jQuery 1.1
* to offer multiple easing options
*
* TERMS OF USE - jQuery Easing
*
* Open source under the BSD License.
*
@sousk
sousk / snippet.txt
Created March 17, 2010 02:21
Trac - custom query, all active tickets and mine first
SELECT p.value AS __color__,
(CASE owner
WHEN '$USER' THEN 'My Tickets'
ELSE 'Active Tickets'
END) AS __group__,
id AS ticket, summary, component, version, milestone, t.type AS type, severity,
(CASE status WHEN 'assigned' THEN owner||' *' ELSE owner END) AS owner,
time AS created,
changetime AS _changetime, description AS _description,
reporter AS _reporter
@sousk
sousk / How to Cook Well
Created March 31, 2010 08:40
how to cook well with a pan
まず、一つ誤解をといておくと
[10/03/31 17:25:42] なかい@DINO: 強火で焦げ目つけてうまみ閉じ込めるってのは非科学的で根拠のない寝言
[10/03/31 17:26:04] なかい@DINO: 低温で焼き始めて、温度あげていくのが正解
[10/03/31 17:26:44] なかい@DINO: で、弱火で焼いてると40-50度超えたあたりで水分出てくるんだけど、これがアクです。
[10/03/31 17:26:51] なかい@DINO: ので、初期油と一緒にペーパーで拭き取っちゃう。
[10/03/31 17:27:18] なかい@DINO: あ、なので最初は冷たいフライパンに材料並べましょう
ポイントは50-80度あたりをどれだけゆっくり通過させるか
[10/03/31 17:29:25] なかい@DINO: ここを早く通過させると、うまみとか必要な水分が細胞の収縮とともに全部流れ出ます
[10/03/31 17:30:04] なかい@DINO: 揚げ物するときも一緒で
@sousk
sousk / encode cliped URL
Created May 12, 2010 09:36
escape your copied url string
echo `pbpaste` | ruby -e 'require "uri";print $<.gets.chomp!.gsub!(/([^\/]+)/){|m| URI.escape(m)}' | pbcopy
#!/usr/bin/env ruby
$LOAD_PATH << "#{ENV["TM_SUPPORT_PATH"]}/lib"
require "web_preview"
class SymfonyLimeTest
attr_reader :root_dir, :test_file
def initialize(args=ENV)