Skip to content
View jQueryAjaxSettings.ts
interface JQueryAjaxSettings {
/**
* The content type sent in the request header that tells the server what kind of response it will accept in return. If the accepts setting needs modification, it is recommended to do so once in the $.ajaxSetup() method.
*/
accepts?: any;
/**
* By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need synchronous requests, set this option to false. Cross-domain requests and dataType: "jsonp" requests do not support synchronous operation. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. As of jQuery 1.8, the use of async: false with jqXHR ($.Deferred) is deprecated; you must use the success/error/complete callback options instead of the corresponding methods of the jqXHR object such as jqXHR.done() or the deprecated jqXHR.success().
*/
async?: boolean;
/**
View .babelrc
{
"presets": ["es2015"],
"plugins": ["transform-runtime"]
}
View foo.ts
class Foo {
config: any;
constructor(config) {
this.config = config;
}
}
View gist:f70730d1ece8420d362b3ac28e462b22
ln -s $(go list -f "{{.Dir}}" github.com/c9s/fsrename/fsrename) \
$(go list -f "{{.Root}}" github.com/c9s/fsrename/fsrename)/src/fsrename
View pipe.php
<?php
$phase1Result = array_filter($input, function($item) { .... });
$phase2Result = array_map(function($item) use ($ex1, $ex2) {
.... do something
}, $phase2Result);
$phase3Result = array_map(function($item) use ($a1, $a2) {
.... do something
}, $phase3Result);
// 組合在一起
View mock.php
<?php
$houseWork = new HouseWork;
$originalMethod = mock($houseWork, "GetToday", function() {
// $this works here.
$date = new DateTime;
$date->setDate(2016, 4, 16);
return $date;
});
$houseWork->WhoShouldWork();
unmock($houseWork, $originalMethod);
View getter.php
<?php
class StatusGetter {
protected $status;
public function __construct($status) {
$this->status = $status;
}
View benchmark.php
<?php
require 'vendor/autoload.php';
class User {
public $name;
public function __construct($name) {
$this->name = $name;
}
View after.txt
simple 0.156
simplecall 0.047
simpleucall 0.154
simpleudcall 0.174
mandel 0.754
mandel2 0.872
ackermann(7) 0.158
ary(50000) 0.021
ary2(50000) 0.017
ary3(2000) 0.403
View obj-poly.php
<?php
interface Intf {
public function getA();
}
class MyFoo implements Intf {
public $a;
public function getA() {
return $this->a;
}
Something went wrong with that request. Please try again.