First, Lets find out what version of PHP we're running (To find out if it's the default version).
To do that, Within the terminal, Fire this command:
which php
function getAllPropertyNames(obj) { | |
var result = []; | |
while (obj) { | |
// Add the own property names of `obj` to `result` | |
Array.prototype.push.apply(result, Object.getOwnPropertyNames(obj)); | |
obj = Object.getPrototypeOf(obj); | |
} | |
return result; | |
} |
<html> | |
<head> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> | |
<script type="text/Javascript"> | |
$(document).ready(function () { | |
$(function () { | |
$('.add').on('click',function(){ | |
var $qty=$(this).closest('p').find('.qty'); |
// Via Object Literal | |
var obj = { | |
get foo() { | |
return 'getter'; | |
}, | |
set foo(value) { | |
console.log('setter: ' + value); | |
} |
• Apply the array method map() to a string: | |
> [].map.call('abc', function (x) { return x.toUpperCase() }) | |
[ 'A', 'B', 'C' ] | |
Using map() generically is more efficient than using split(''), which creates an intermediate array: | |
> 'abc'.split('').map(function (x) { return x.toUpperCase() }) | |
[ 'A', 'B', 'C' ] | |
Apply a string method to nonstrings. toUpperCase() converts the receiver to a string and uppercases the result: | |
> String.prototype.toUpperCase.call(true) |
Cheat Sheet: Working with Objects | |
This section is a quick reference with pointers to more thorough explanations. | |
• Object literals (see “Object Literals” on page 198): | |
var jane = { | |
name: 'Jane', | |
'not an identifier': 123, | |
describe: function () { // method | |
return 'Person named '+this.name; | |
}, |
import UIKit | |
class ViewController: UIViewController { | |
var xFromCenter: CGFloat = 0 | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view, typically from a nib. | |
class UserTableViewController: UITableViewController { | |
var refresher: UIRefreshControl! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view, typically from a nib. | |
refresher = UIRefreshControl() |
{ | |
// http://eslint.org/docs/rules/ | |
"ecmaFeatures": { | |
"binaryLiterals": false, // enable binary literals | |
"blockBindings": false, // enable let and const (aka block bindings) | |
"defaultParams": false, // enable default function parameters | |
"forOf": false, // enable for-of loops | |
"generators": false, // enable generators | |
"objectLiteralComputedProperties": false, // enable computed object literal property names |