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
| <?php | |
| // Let's assume this is coming from a config file somewhere | |
| // that maybe we can't trust, or could allow for someone to | |
| // accidently add the same host/port twice. | |
| $servers = array( | |
| array("host" => 'localhost', "port" => 11211, "weight" => 10), | |
| array("host" => 'localhost', "port" => 11212, "weight" => 20) | |
| ); |
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
| <?php | |
| // Let's assume this is coming from a config file somewhere | |
| // that we can trust to not have duplicate servers in the list. | |
| $servers = array( | |
| array("host" => 'localhost', "port" => 11211, "weight" => 10), | |
| array("host" => 'localhost', "port" => 11212, "weight" => 20) | |
| ); | |
| $mc = new Memcached("test"); |
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
| <?php | |
| if($whatever){ | |
| do_stuff(); | |
| } else { | |
| $result["success"] = false; | |
| $result["message"] = "FAILURE: Some error message"; | |
| } | |
| return $result; | |
| ?> |
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
| <?php | |
| /** | |
| * Given two timestamps and a integer, returns the Y-m-d range, separated by days | |
| * of that integer | |
| * | |
| * @param int $start_ts Starting timestamp | |
| * @param int $end_ts Ending timestamp | |
| * @return array | |
| * | |
| * @test |
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
| <?php | |
| /** | |
| * Given two timestamps returns the Y-m-d ranges for each week within the range. | |
| * | |
| * @param int $start_ts Starting timestamp | |
| * @param int $end_ts Ending timestamp | |
| * @param bool $full_weeks If true, full weeks will be returned meaning | |
| * the start and end will be adjusted to create full weeks | |
| * @return array |
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
| $ ./pecl-manager.php -c config-single.ini -w ./pecl-worker-classes -vvv | |
| PID Type Message | |
| 25968 INFO Loading workers in ./pecl-worker-classes | |
| 25969 PROC Helper forked | |
| 25969 INFO Loading workers in ./pecl-worker-classes | |
| 25968 PROC Started with pid 25968 | |
| 25970 WORKER Adding server 127.0.0.1 | |
| 25970 WORKER Adding job Avg | |
| 25970 WORKER Adding job Sum | |
| 25968 PROC Started child 25970 (Avg,Sum) |
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
| #!/usr/bin/lua | |
| -- Requires lua 5.1+ and lua socket | |
| -- | |
| -- Copyright (c) 2015, Brian Moon | |
| -- All rights reserved. | |
| -- | |
| -- Redistribution and use in source and binary forms, with or without | |
| -- modification, are permitted provided that the following conditions are met: | |
| -- | |
| -- * Redistributions of source code must retain the above copyright notice, |
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
| function getWindowMediaWidth() { | |
| if(!window.matchMedia){ | |
| // it should be this, so return it when we can't | |
| // figure it out. Of course, it does not do a lot | |
| // of good if the browser does not support media | |
| // queries. | |
| return document.body.clientWidth; | |
| } |
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
| <?php | |
| class Foo { | |
| private $bar = "private variable 1"; | |
| private $bar2 = "private variable 2"; | |
| } | |
| $foo = new Foo; | |
| echo current($foo)."\n"; |
OlderNewer