This file contains 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
check process redis-server | |
with pidfile "/var/run/redis.pid" | |
start program = "/etc/init.d/redis-server start" | |
stop program = "/etc/init.d/redis-server stop" | |
if 2 restarts within 3 cycles then timeout | |
if totalmem > 100 Mb then alert | |
if children > 255 for 5 cycles then stop | |
if cpu usage > 95% for 3 cycles then restart | |
if failed host 127.0.0.1 port 6379 then restart | |
if 5 restarts within 5 cycles then timeout |
This file contains 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
# ... | |
json_response = JSON.parse(response.body) | |
# Look only at 'attributes' part of both arrays (expected and actual) | |
assert_same_elements json_response['attributes'], expected['attributes'] | |
# Compare for equality excluding 'attributes' from both arrays | |
assert_equal json_response.except('attributes'), expected.except('attributes') | |
This file contains 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
1) Failure: | |
Test#test_should_get_something [.../..._controller_test.rb:101]: | |
--- expected | |
+++ actual | |
@@ -1 +1 @@ | |
-{"something"=>"anything", "index"=>"1", "attributes"=>[{"name"=>"guns", "value"=>"roses"}, {"name"=>"carpet", "value"=>"sofa"}, {"name"=>"sys", "value"=>"log"}, {"name"=>"red", "value"=>"hot"}], "where"=>"am_i"} | |
+{"something"=>"anything", "index"=>"1", "attributes"=>[{"name"=>"sys", "value"=>"log"}, {"name"=>"guns", "value"=>"roses"}, {"name"=>"carpet", "value"=>"sofa"}, {"name"=>"red", "value"=>"hot"}], "where"=>"am_i"} |
This file contains 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
one: | |
name: "guns" | |
value: "roses" | |
two: | |
name: "red" | |
value: "hot" | |
three: | |
name: "carpet" |
This file contains 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
def test_should_get_something | |
get :show, id: 1114, format: 'json' | |
expected = { | |
'something' => 'anything', | |
'index' => '1', | |
'attributes' => [ | |
{ 'name' => 'guns', 'value' => 'roses' }, | |
{ 'name' => 'red', 'value' => 'hot' }, | |
{ 'name' => 'carpet', 'value' => 'sofa' }, |
This file contains 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
git --no-pager show -s --format='%an <%ae> on %cd' --date=short 4f340aex43508c86xxxxxx69f4803114cxca2ae7 | |
Username <address@gmail.com> on 2016-04-04 |
This file contains 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
// get actual user picture from VKONTAKTE by UID | |
- (void)getUserPictureVK:(NSString*)uid | |
{ | |
NSString *requestURLstring = [NSString stringWithFormat:@"https://api.vkontakte.ru/method/getProfiles?uid=%@&fields=photo", uid]; | |
NSURL *requestURL = [NSURL URLWithString:requestURLstring]; | |
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:requestURL]; | |
[request setTimeoutInterval:10]; | |
AFJSONRequestOperation *operation = [AFJSONRequestOperation operationWithRequest:request | |
success:^(id JSON) { |
This file contains 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
gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config | |
Building native extensions with: '--with-mysql-config=/usr/local/mysql/bin/mysql_config' | |
This could take a while... | |
Successfully installed mysql-2.9.1 | |
Parsing documentation for mysql-2.9.1 | |
Installing ri documentation for mysql-2.9.1 | |
Done installing documentation for mysql after 0 seconds | |
1 gem installed |
This file contains 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
gem install mysql | |
Fetching: mysql-2.9.1.gem (100%) | |
Building native extensions. This could take a while... | |
ERROR: Error installing mysql: | |
ERROR: Failed to build gem native extension. | |
... | |
checking for mysql_query() in -lmysqlclient... no | |
checking for main() in -lm... yes | |
checking for mysql_query() in -lmysqlclient... no | |
checking for main() in -lz... yes |
This file contains 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
def checkio(data, r=0): | |
if len(data) == 0: | |
return r | |
r += data.pop() | |
return checkio(data, r) |
NewerOlder