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
if (typeof Object.create !== "function") { | |
Object.create = function (proto) { | |
function Type() { } | |
Type.prototype = proto; | |
return new Type(); | |
}; | |
} | |
function Animal(name) { | |
var self = this; |
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
@@ -176,7 +176,7 @@ all: Wrap return value | |
$__ = new self; | |
if(!is_null($iterator)) $collection = $__->map($collection, $iterator); | |
$collection = (array) $collection; | |
- if(count($collection) === 0) return true; | |
+ if(count($collection) === 0) return self::_wrap(true); | |
return self::_wrap(is_bool(array_search(false, $collection, false))); | |
} | |
@@ -191,8 +191,8 @@ filter: Pass key to iterator |
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
Array | |
( | |
[0] => 5 | |
[1] => 1 | |
[2] => 3 | |
[3] => 0 | |
[4] => 6 | |
[5] => 8 | |
[6] => 4 | |
[7] => 9 |
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 | |
__()->mixin([ | |
"reindex" => function ($items, $indices) { | |
return __($indices)->map(function ($index) use ($items) { return $items[$index]; }); | |
}, | |
"multisort" => function ($items, $keys) { | |
if (count($items) <= 1) { | |
return $items; | |
} |
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
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<configSections> | |
<section name="presidents1" type="System.Configuration.NameValueSectionHandler" /> | |
<section name="presidents2" type="CustomConfig.PresidentListSection, Custom Config" /> | |
</configSections> | |
<presidents1> | |
<add key="1" value="George Washington" /> | |
<add key="2" value="John Adams" /> | |
<add key="3" value="Thomas Jefferson" /> |
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
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<appSettings> | |
<add key="Distance" value="10" /> | |
<add key="Timeout" value="1:00" /> | |
</appSettings> | |
</configuration> |
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 download($url) { | |
$curl = curl_init($url); | |
curl_setopt_array($curl, [ | |
CURLOPT_FOLLOWLOCATION => true, | |
CURLOPT_RETURNTRANSFER => true | |
]); | |
$data = curl_exec($curl); | |
curl_close($curl); | |
return $data; |
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
# Set up repo | |
cvs checkout repo | |
cd repo | |
hg init | |
>> .hgignore echo syntax: glob | |
>> .hgignore echo CVS/* | |
>> .hgignore echo .cvsignore | |
# Consult .cvsignore files | |
hg addremove | |
# Verify pending changes |
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
ko.extenders.cache1 = function (target) { | |
target.cached = ko.observable(target.peek()); | |
target.cache = function () { | |
target.cached(target()); | |
}; | |
return target; | |
}; | |
var x = ko.observable(1).extend({ cache1: {} }); | |
x(2); |
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
ko.extenders.coalesce = function (target, defaultValue) { | |
var result = ko.computed({ | |
read: function () { | |
return target() === undefined ? ko.unwrap(defaultValue) : target(); | |
}, | |
write: function (value) { | |
target(value); | |
} | |
}); | |
result.defaultValue = ko.computed(function () { |
OlderNewer