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
# guard start -i | |
# A sample Guardfile | |
# More info at https://github.com/guard/guard#readme | |
guard :shell, :all_on_start => false do | |
watch %r{((app|tests|lib/(src|tests))/.*\.php$)} do |m| | |
puts "######################## start syntax check #{m[0]} ##############################" | |
system("php /home/yoshimin/project/PHP-Parser/syntax_check.php #{m[0]}") | |
end |
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
<?php | |
function echoCount($val) | |
{ | |
var_dump($val); | |
echo "=> "; | |
echo count($val); | |
echo "\n"; | |
} |
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
<?php | |
$options = array('foo' => 'bar', 'baz' => 'boo'); | |
$default = array('foo' => 'aaa'); | |
$options += $default; | |
var_dump($options); |
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
#!/usr/bin/env php<?php | |
require_once('lib/TestTap.php'); | |
$t = new TestTap(); | |
$t->subtest("nullのケース", function($t) { | |
$a = null; | |
$t->is($a, null, "null ok"); | |
$t->is($a['xxxxx'], null, "null ok"); | |
}); |
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
diff --git a/lib/CloudForecast/Data/Mysqlcachehit.pm b/lib/CloudForecast/Data/Mysqlcachehit.pm | |
index 4ef3ae6..238dca8 100644 | |
--- a/lib/CloudForecast/Data/Mysqlcachehit.pm | |
+++ b/lib/CloudForecast/Data/Mysqlcachehit.pm | |
@@ -93,13 +93,13 @@ fetcher { | |
(1.0 - $status{'key_reads'} / $status{'key_read_requests'} ) * 100; | |
my $query_cache = sprintf '%.2f', | |
- ($status{'qcache_hits'} / ($status{'qcache_inserts'} + $status{'qcache_hits'} + $status{'qcache_not_cached'}) | |
+ ($status{'qcache_hits'} / ( ($status{'qcache_inserts'} + $status{'qcache_hits'} + $status{'qcache_not_cached' |
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
./test_rankd [ ~/project/cpp/rankd git[master] ] | |
# Testing: top_same_value | |
ok 1 - top ok | |
ok 2 - get_rank ok | |
ok 3 - top ok | |
# Testing: top_test2 | |
ok 4 - 82 should be rank 0 | |
# top 82 | |
ok 5 - top ok | |
ok 6 - 82 should be rank 1 |
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
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use opts; | |
use Net::SSH; | |
use Parallel::ForkManager; | |
use IO::Socket; | |
use IO::File; | |
use IO::Select; |
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
void get_memory_usage(char *memsiz){ | |
pid_t pid = getpid(); | |
FILE *fh = popen("ps aux", "r"); | |
char buffer[BUFSIZ]; | |
char colbuf[BUFSIZ]; | |
if ( fh == NULL ) { | |
perror("popen"); | |
exit(1); | |
} else { | |
while ( fgets(buffer, BUFSIZ, fh) != NULL ) { |
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
use strict; | |
use warnings; | |
use List::Util; | |
use String::Random; | |
List::Util::shuffle(1, 2, 3); | |
my @pids; | |
for my $counter ( 1..3 ) { | |
my $pid = fork(); |
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
module Orderd | |
class Ranking | |
def initialize | |
@first = @last = Node.new | |
@item_id_of = {} | |
@marker_of = {} | |
@size = 0 | |
end | |
def top item_id |