Skip to content

Instantly share code, notes, and snippets.

Paul Maček macek

Block or report user

Report or block macek

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
macek /
Created Oct 18, 2011
configure irssi-xmpp
LDFLAGS += -flat_namespace -undefined warning -fPIC
macek / sql_sanitizer.php
Created Apr 15, 2011
POS410 SQL sanitizer example
View sql_sanitizer.php
class Mysql {
static public function query(){
$args = func_get_args();
return mysql_query(call_user_func_array(array("self", "queryf"), $args));
static public function queryf(){
macek / Gemfile
Created Nov 16, 2010
Quick Sinatra App on Heroku
View Gemfile
source ''
gem "sinatra"
macek / 20101004063749_create_photos.rb
Created Oct 4, 2010
How to save uploaded files to your database in Rails
View 20101004063749_create_photos.rb
# db/migrate/20101004063749_create_photos.rb
class CreatePhotos < ActiveRecord::Migration
def self.up
create_table :photos do |t|
t.string :name, :null => false
t.binary :data, :null => false
t.string :filename
t.string :mime_type
macek / .htaccess
Created Sep 29, 2010
Redirect without www on Nginx and Engine Yard
View .htaccess
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
macek / access_default_search.rb
Created Sep 24, 2010
Advanced Techniques for Searchlogic 2
View access_default_search.rb
# your custom search
@search =[:search])
# searchlogic default
@search = Product.searchlogic(params[:search])
macek / advanced_output
Created Sep 24, 2010
Output Buffering with Ruby
View advanced_output
A contents <<<
send this to a
this goes to a
a, I forgot to add this
B contents <<<
this goes to b
b, please
macek /
Created Sep 24, 2010
Running Rake tasks in Engine Yard Crontab
cd /data/MyApp/current && /usr/bin/rake some:task
View Compile.tmCommand
#!/usr/bin/env ruby
require 'net/http'
require 'uri'
require 'json'
response = Net::HTTP.post_form(
:js_code =>,
View monty_hall.rb
require "benchmark"
ITERATIONS = (ARGV[0] || 10000).to_i
def pick(set)
def trial(method)
You can’t perform that action at this time.