Skip to content

Instantly share code, notes, and snippets.

hablo programación

Przemek Sobstel sobstel

hablo programación
Block or report user

Report or block sobstel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
sobstel / EnumType.php
Created Dec 13, 2010
Doctrine2 EnumType
View EnumType.php
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Platforms\AbstractPlatform;
* My custom datatype.
class EnumType extends Type
const ENUM = 'enum';
View Doctrine_Hydrator_FlatArray.class.php
* Doctrine::HYDRATE_SCALAR without component alias at the beginning.
* For key names it takes columns and aliases from SELECT statement.
* First column/alias from statement is used as key for whole row.
class Doctrine_Hydrator_FlatArray extends Doctrine_Hydrator_ScalarDriver {
public function hydrateResultSet($stmt)
sobstel / jQuery.fn.whenLoaded.js
Created Jan 21, 2011
jQuery onload event for images
View jQuery.fn.whenLoaded.js
jQuery.fn.whenLoaded = function(fn){
return this.each(function(){
// if already loaded call callback
if (this.complete || this.readyState == 'complete'){;
} else { // otherwise bind onload event
sobstel / will_paginate_in_rails3.example.rb
Created Jan 21, 2011
will_paginate query with per_page working in rails3
View will_paginate_in_rails3.example.rb
@articles = Article.
select('articles.*, (SUM( = 1)/COUNT( votes_ratio, COUNT( votes_num').
having('votes_num >= 5 AND votes_ratio >= 0.8').
order('votes_ratio DESC, votes_num DESC').
paginate(:page => params[:page], :per_page => Article.per_page)
sobstel / function_in_method.php
Created Jan 28, 2011
PHP: function in method
View function_in_method.php
class FooClass {
public function foo_method() {
function foo_func() {
echo "it works, really";
$foo = new FooClass;
sobstel /
Created Feb 2, 2011
Lazy assignment pattern
var i:int = 0, l:int = points.length;
while (i < l) {
sobstel / hirb&wirble.rb
Created Feb 10, 2011
hirb and wirble configuration
View hirb&wirble.rb
# Source:
# File: ~/.irbc
require 'rubygems'
require 'wirble'
require 'hirb'
if ENV.include?('RAILS_ENV') && !Object.const_defined?('RAILS_DEFAULT_LOGGER')
require 'logger'
sobstel / interpret_status.rails3.rb
Created Feb 19, 2011
interpret_status in rails3
View interpret_status.rails3.rb
def interpret_status(status)
Rack::Utils::HTTP_STATUS_CODES[status.to_i] || status.to_s
sobstel / config
Created Mar 4, 2011
~/.mplayer/config (polish font in mplayer)
View config
sobstel / comment.rb
Created Mar 11, 2011
mongoid: embedded document without object_id
View comment.rb
class Comment
include Mongoid::Document
field :name
# do not generate object_id
# for mongoid <=2.0rc7 (in newer mongoid use Mongoid.embedded_object_id = false)
def identify
You can’t perform that action at this time.