Use $this to refer to the current object. Use self to refer to the current class. In other words, use $this->member for non-static members, use self::$member for static members.
Source: When to use self vs this -stackoverflow
function retrieveEnvHostName() { | |
var injectedMstScriptTag = document.getElementById('ms-transfer-api'); | |
var success = false; | |
var exceptionMsg; | |
if (injectedMstScriptTag == undefined || injectedMstScriptTag == null || injectedMstScriptTag == '') { | |
exceptionMsg = "Fatal error: Could not retrieve script tag ms-transfer-api!"; | |
} else { | |
Signiant.Mst.envHostName = (injectedMstScriptTag).getAttribute('env-host-name'); | |
if (Signiant.Mst.envHostName === undefined || Signiant.Mst.envHostName == null || Signiant.Mst.envHostName.length == 0) { | |
exceptionMsg = "Fatal error: Could not retrieve env-host-name from script tag ms-transfer-api!"; |
using System.Linq; | |
using System.Net; | |
using System.Net.Http; | |
using System.Threading.Tasks; | |
using System.Collections.Specialized; | |
class DataService { | |
public NameValueCollection Query { get; set; } | |
public string Endpoint { get; set; } | |
public FormUrlEncodedContent QueryEncoded { |
using UnityEngine; | |
using System.Collections; | |
using UnityEditor; | |
using System.IO; | |
public class SDKSwap : EditorWindow { | |
static string _cardboardPath; | |
static string _OVRPath; |
{ | |
"$schema": "http://json-schema.org/draft-07/schema#", | |
"title": "SurveyJS Library json schema", | |
"type": "object", | |
"properties": { | |
"pages": { | |
"type": "array", | |
"items": { | |
"$ref": "#/definitions/page" | |
} |
Use $this to refer to the current object. Use self to refer to the current class. In other words, use $this->member for non-static members, use self::$member for static members.
Source: When to use self vs this -stackoverflow
// by Erik Wrenholt | |
import java.util.*; | |
class Mandelbrot | |
{ | |
static int BAILOUT = 16; | |
static int MAX_ITERATIONS = 1000; | |
private static int iterate(float x, float y) | |
{ |
/** @jsx React.DOM */ | |
var STATES = [ | |
'AL', 'AK', 'AS', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'DC', 'FL', 'GA', 'HI', | |
'ID', 'IL', 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MD', 'MA', 'MI', 'MN', 'MS', | |
'MO', 'MT', 'NE', 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH', 'OK', 'OR', | |
'PA', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'WY' | |
] | |
var Example = React.createClass({ |
FILE SPACING: | |
# double space a file | |
sed G | |
# double space a file which already has blank lines in it. Output file | |
# should contain no more than one blank line between lines of text. | |
sed '/^$/d;G' |
<?xml version="1.0" encoding="UTF-8"?> | |
<opml version="1.0"> | |
<head> | |
<title>Subscriptions - freek@spatie.be</title> | |
</head> | |
<body> | |
<outline text="PHP" title="PHP"> | |
<outline htmlUrl="http://frederickvanbrabant.com" title="frederickvanbrabant.com" xmlUrl="http://frederickvanbrabant.com/feed.xml" type="rss" text="frederickvanbrabant.com"/> | |
<outline htmlUrl="http://mattallan.org" title="mattallan.org" xmlUrl="http://mattallan.org/feed.xml" type="rss" text="mattallan.org"/> | |
<outline title="asked.io" xmlUrl="https://asked.io/rss" type="rss" text="asked.io"/> |