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
use AnyEvent; | |
sub allow_non_blocking_cgi { | |
my ($module) = @_; | |
eval "require $module;" or die $@; ## no critic (ProhibitStringyEval) | |
my $startup = \&{$module.'::startup'}; | |
my $wrapper = sub { | |
my ($app) = @_; | |
&{$startup}; | |
my $done = AnyEvent->condvar; |
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
use AnyEvent::DBI::MySQL; | |
sub startup { | |
my $app = shift; | |
$app->config(db => {dsn=>…, login=>…, pass=>…}); | |
$app->helper(dbh => sub { shift->{dbh} }); | |
$app->helper(new_dbh => sub { | |
state $db = shift->app->config('db') or return; |
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 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta name="viewport" content="width=device-width" /> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<title>{{ template "__subject" . }}</title> | |
</head> | |
<body itemscope itemtype="http://schema.org/EmailMessage"> |
I hereby claim:
- I am powerman on github.
- I am powerman (https://keybase.io/powerman) on keybase.
- I have a public key ASCSBOCcVZFOBR0em9fFkAAWPJX7QbEQq69BY9wDKS_n2Qo
To claim this, I am signing this object:
Modern projects often support HTTPS and HTTP/2, moreover they can use Strict-Transport-Security:
and
Content-Security-Policy:
headers which result in different behaviour for HTTP and HTTPS versions, or
even completely forbid HTTP version. To develop and test such project locally, on CI, and at staging server
we either have to provide a way to access it using HTTP in non-production environments (bad idea) or
somehow make it work with HTTPS everywhere.
HTTP in non-production environments is a bad idea because we'll test not the same thing which will runs on production, and because there is a chance to occasionally keep HTTP enabled on production too.
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
// Package tail implements behaviour of `tail -n 0 -F path`. | |
package tail | |
import ( | |
"time" | |
) | |
var ( | |
pollDelay = 200 * time.Millisecond // delay between polling to save CPU | |
pollTimeout = time.Second // how long to wait before returning os.ErrNotExist |
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
/*** MY OVERRIDES ***/ | |
user_pref("_user.js.parrot", "overrides section syntax error"); | |
/* [UX,-HIST] Restore previous session after Firefox restart. */ | |
user_pref("browser.startup.page", 3); // 0102 | |
/* [UX,-GEO] Allow websites to detect my locale. */ | |
user_pref("intl.accept_languages", "ru,en-us,en"); // 0210 | |
user_pref("javascript.use_us_english_locale", false); // 0211 |
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
package expdelay | |
import "time" | |
// ExpDelay implements exponential delay. | |
type ExpDelay struct{ cur, max time.Duration } | |
// New returns new exponential delay which start with min delay, increase | |
// each next delay in 2 times up to max delay. | |
// |
OlderNewer