If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
<?php | |
class Solution { | |
public function cool($val){ | |
if (($val % 3 ) == 0 || ($val % 5) == 0){ | |
return $val; | |
} return 0; | |
} | |
function solveFor ( $limit ) | |
{ |
<?php | |
use \lithium\core\Libraries; | |
// Lots of other stuff... | |
/** | |
* Zend Framework 1.11.x is installed via PEAR into the standard PHP include_path | |
* location. We just need Lithium to know how to get to it. | |
*/ |
require "enumerator" | |
class Solution | |
include Enumerable | |
def initialize ( cap=nil ) | |
@e = Enumerator.new do |yielder| | |
a = b = 1 | |
loop do | |
break if cap && b > cap |
#!/usr/bin/env php | |
<?php | |
/** | |
* Either make this file executable with `chmod +x read.php` or | |
* run with `php read.php` passing the input file as the first | |
* argument, e.g. `php read.php data.csv` or `read.php data.csv`. | |
* If the file contains a header row, add an environment variable, | |
* like so: `CSV_HEADER_ROW=1 php read.php data.csv` | |
*/ |
<script src="http://www.rackspace.com/script/loadbalancerscalc.js" type="text/javascript"></script> | |
<script src="http://www.rackspace.com/script/serverscalc.js" type="text/javascript"></script> | |
<script src="http://www.rackspace.com/script/serverscalc.js" type="text/javascript"></script> |
--bare --mirror
clone in some central location on the server, e.g. /var/git/some-site.git
git clone /var/git/some-site.git /var/www/some-site.com/
config
into /var/git/some-site.git/config
(don't overwrite)git add-deployed
to tell the central repo where your deployments are, e.g.git add-deployed master /var/www/some-site.com/
update-mirror
and update-deployed
for your repo, e.g.<?php | |
function next_highest_multiple($number, $multiple) | |
{ | |
if ( $multiple > $number ) return $multiple; | |
if ( $multiple == 0 ) return 0; | |
return ( ($remainder = $number % $multiple) ? | |
$number + $multiple - $remainder : $number |
<?php | |
$find_openshift_db = function($variables){ | |
$keys = array_filter(array_keys($variables), function($key){ | |
return (strpos($key, 'OPENSHIFT') === 0); | |
}); | |
return array_intersect_key($variables, array_flip($keys)); | |
}; | |
?> |
- attrs={ "ngApp": "something" } | |
%p(**attrs) | |
This element should have an attribute <code>ng-app="something"</code>. | | |
It works just fine. | |
%%(def(name="some_def(**attrs)") | |
= attrs | |
%p(**attrs) | |
= caller.body() or 'Cannot pass a body to a function... :/' |