Skip to content

Instantly share code, notes, and snippets.

View Porta's full-sized avatar

Julián Porta Porta

View GitHub Profile
local function search(words)
local cached_key, cached = temp_dest_key(words)
if cached == false then
redis.call('BITOP', 'AND', cached_key, unpack( namespace_keys(words) ) )
cached = redis.call('GET', cached_key)
end
return cached
end
@Porta
Porta / regexp.js
Last active December 28, 2015 02:49
/([^\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0
@Porta
Porta / hola
Created September 25, 2013 10:03
javascript: $('p.mod-messageList-selector-itemCheck').addClass('checked').attr('check', '1'); alert('muchas gracias, vuelva pronto'); return false;
class Bucket < Ohm::Model
attribute :name
attribute :token
list :unread, :Request
end
@Porta
Porta / antes.rb
Last active December 21, 2015 00:58
class Poxy
class RequestFactory
def initialize(target, rack_request)
@rp = Poxy::RequestProcessor.new(rack_request)
method, headers, query_string, params, body = @rp.parsed
url = fix_url(target, query_string)
headers = fix_headers(headers)
HTTPI.adapter = :curb
@request = HTTPI::Request.new(
{
"method": "POST",
"source": null,
"params": {
"id": "1392",
"form_id": "52",
"date_created": "2013-05-29 16:38:53",
"is_starred": "0",
"is_read": "0",
"ip": "190.192.7.129",
<?php
if ( has_post_thumbnail( $post_id ) ) {
// check if to show lightbox desc and title
if ( get_option_max( 'pretty_title_show' ) == 'true' ){
$title = ' title="' . get_the_excerpt() . '"';
}
$cat_list = array();
<!DOCTYPE html>
<html>
<head>
<title>La llama que llama</title>
</head>
<body>
<h1>La llama que habla</h1>
<p>
<img title="OLA K ASE" src="http://www.oyemexico.com/wp-content/uploads/2012/12/TUku4-380x285.jpg" alt="Una Llama que habla" />
</p>
# >-----------------------------[ Run 'Bundle Install' ]-------------------------------<
say_wizard "Installing gems. This will take a while."
if prefs.has_key? :bundle_path
run "bundle install --without production --path #{prefs[:bundle_path]} --standalone"
else
run 'bundle install --without production --standalone'
end
# >-----------------------------[ Run 'After Bundler' Callbacks ]-------------------------------<
@Porta
Porta / states.rb
Created May 15, 2012 20:44
Concern
module States
extend ActiveSupport::Concern
included do
state_machine :status, :initial => :new do
event :confirm do
transition :new => :confirmed #, :if => lambda {|order| order.email.present?}
end