This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~ $ 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 | |
> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
} | |
} | |
})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ModelBase < ActiveRecord::Base | |
end | |
class BaseA < ModelBase | |
has_many :things, :as => :model_a | |
end | |
class BaseB < ModelBase | |
has_many :things, :as => :model_b | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
set -u | |
NAME=<set your application name here> | |
DIRECTORY=<set your application directory here> | |
PIDFILE=/var/run/$NAME.pid | |
DAEMON="/usr/local/rvm/bin/rvm exec rackup" | |
DAEMON_ARGS="-s Kirk config.ru -p 3000 -P $PIDFILE" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
</head> | |
<body> | |
<script type="text/javascript"> | |
alert("string".constructor == String); | |
</script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript"> | |
var array = []; | |
var emptyArray = []; | |
console.log(array); | |
// Google Chrome 10.0.648.204 #=> [1, 2, 3, 4, 5, 6] - WTF? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript"> | |
var array = []; | |
var emptyArray = []; | |
console.log(array); | |
// Google Chrome 10.0.648.204 #=> [1, 2, 3, 4, 5, 6] - WTF? |