Skip to content

Instantly share code, notes, and snippets.

View filiptepper's full-sized avatar
🏠
Working from home

Filip Tepper filiptepper

🏠
Working from home
View GitHub Profile
module Marshal
class << self
@@prok = Proc.new { |o| o.is_a?(String) ? Iconv.iconv("UTF-8//IGNORE", "UTF-8", o.force_encoding("UTF-8").encode("UTF-8")).first : o }
alias old_load load
def load(source)
old_load source, @@prok
end
end
update.body = "To jest wiadomość. Z linkiem. Do blipnięcia. http://blip.pl/s/1234567"
Sphinx query: blip
Wynik: 1 wiadomość
Spodziewany wynik: 0 wiadomości
Idea: nieindeksowanie URL-i (czyli np. zaindeksowane są "To jest wiadomość Z linkiem Do blipnięcia", pominięte "http://blip.pl/s/1234567").
var Chromac = (function(){
return {
handleBookmarksBar: function(e) {
if ((e.metaKey === true || e.ctrlKey === true) && e.shiftKey === true && (e.keyCode >= 49 && e.keyCode <= 57)) {
chrome.extension.sendRequest({ name: "bookmarksBar", id: (-48 + parseInt(e.keyCode)), new_tab: e.altKey });
e.preventDefault();
}
}
}
})();
# encoding: utf-8
gem "mail", "2.2.1"
require "mail"
message = Mail.new
message.charset = "UTF-8"
message.from = "zażółć gęślą jaźń <[email protected]>"
message.body = "zażółć gęślą jaźń, biatch!"
message.subject = "Jest pięknie gdy zażółć gęślą jaźń przechodzi."
~ $ curl -v -H'Accept: application/json' -H'X-Blip-API: 0.02' http://api.blip.pl/shortlinks/8ap91
* About to connect() to api.blip.pl port 80 (#0)
* Trying 91.197.13.170... connected
* Connected to api.blip.pl (91.197.13.170) port 80 (#0)
> GET /shortlinks/8ap91 HTTP/1.1
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8l zlib/1.2.3
> Host: api.blip.pl
> Accept: application/json
> X-Blip-API: 0.02
>
def dispatch!(connection, clazz)
n = 0
for queue in @routing.queue_names_routing_class(clazz)
begin
result = connection.retrieve(queue)
if result
n += 1
handler = @routing[queue]
method_name = @routing.method_name(queue)
logger.debug("Calling #{handler.class.to_s}\##{method_name}(#{result.inspect})")
require "eventmachine"
module Thrift
class EventMachineServer < BaseServer
def initialize(processor)
@em = Class.new(EM::Connection) do
class << self
attr_accessor :processor
end
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script>
function start(){
localStorage['script'] = '';
window.odswierzaj = false;
chrome.browserAction.setBadgeText({text: ""});
window.bliplogin = localStorage['bliplogin'];
window.bliphaslo = localStorage['bliphaslo'];
window.dzialanie = localStorage['dzialanie'];
class Redis
def get(key)
call_command [:get, key]
end
end
require "rubygems"
require "sinatra"
require "oauth"
require "oauth/consumer"
enable :sessions
before do
session[:oauth] ||= {}