Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
> module Huffman where | |
> import Control.Arrow | |
> import Data.List | |
> import qualified Data.Map as M | |
> import Data.Function | |
This typeclass is supposed to make life _a bit_ easier. |
# updated from the original @ http://cheat.errtheblog.com/s/rspec_shoulda | |
# just a subset -- models -- is included here. I'll update this, and create cheat sheets for others, as I go along. | |
# I marked the ones I added with NEW and also added the links to the corresponding code, as I think it's useful. | |
# Any comments/corrections are welcome! | |
# ================= Data and Associations ======================= | |
# https://github.com/thoughtbot/shoulda-matchers/tree/master/lib/shoulda/matchers/active_record | |
it { should_not have_db_column(:admin).of_type(:boolean) } |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
When hosting our web applications, we often have one public IP
address (i.e., an IP address visible to the outside world)
using which we want to host multiple web apps. For example, one
may wants to host three different web apps respectively for
example1.com
, example2.com
, and example1.com/images
on
the same machine using a single IP address.
How can we do that? Well, the good news is Internet browsers
const int kNewWidth = 200; | |
const int kNewHeight = 400; | |
const float kRescaleFactor = 0.75; | |
/** | |
* Resize mat | |
*/ | |
Mat mat; // Input | |
Mat new_mat; |
2.0.0-p481 :001 > OpenSSL::SSL::SSLContext::DEFAULT_PARAMS
=> {:ssl_version=>"SSLv23", :verify_mode=>1, :ciphers=>"ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW", :options=>-2147482625}
2.0.0-p481 :002 > rating = JSON.parse(RestClient::Resource.new("https://www.howsmyssl.com/a/check" ).get)['rating']
=> "Bad"
void OverlayImage(Mat* src, Mat* overlay, const Point& location) | |
{ | |
for (int y = max(location.y, 0); y < src->rows; ++y) | |
{ | |
int fY = y - location.y; | |
if (fY >= overlay->rows) | |
break; | |
for (int x = max(location.x, 0); x < src->cols; ++x) |