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
git ls-files | grep '\.swp$' | xargs git rm |
// Lists of countries with ISO 3166 codes, presented in various formats. | |
// Last Updated: July 30, 2020 | |
// If you're using PHP, I suggest checking out: | |
// https://github.com/thephpleague/iso3166 | |
// or Laravel: https://github.com/squirephp/squire | |
// | |
// JS developers can check out: | |
// https://www.npmjs.com/package/iso3166-2-db | |
// |
#!/bin/sh | |
### | |
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer) | |
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos | |
### | |
# Alot of these configs have been taken from the various places | |
# on the web, most from here | |
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx |
// Export an excel sheet from a table with JavaScript (in IE): | |
// Usage: CreateExcelSheet("myid"); | |
function CreateExcelSheet( el ) { | |
var x= document.getElementById( el ).rows; | |
var xls = new ActiveXObject("Excel.Application"); | |
xls.visible = true; |
describe("getTweets - Server", function () { | |
var server, fakeData = [ /* ... */ ]; | |
before(function () { | |
// Doesn’t work :( It’s JSONP! | |
server = sinon.fakeServer.create(); | |
server.respondWith( | |
"GET", | |
"https://api.twitter.com/.../elijahmanor.json?count=5", | |
[200, { "Content-Type": "application/json" }, JSON.stringify(fakeData)] |
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
Angry Birds of Modern JavaScript Development
In this session Angry Birds uncover concepts of modern JavaScript development. Each bird represents an area of JavaScript along with its strengths. Some topics covered include code organization, events and messaging, MV* frameworks, prototyping and mocking, design patterns, linting, and build systems. The goal is to defeat the pigs and by doing so produce highly tested quality JavaScript code.
When hosting our web applications, we often have one public IP
address (i.e., an IP address visible to the outside world)
using which we want to host multiple web apps. For example, one
may wants to host three different web apps respectively for
example1.com
, example2.com
, and example1.com/images
on
the same machine using a single IP address.
How can we do that? Well, the good news is Internet browsers
// config/passport.js | |
// load all the things we need | |
var LocalStrategy = require('passport-local').Strategy; | |
var mysql = require('mysql'); | |
var connection = mysql.createConnection({ | |
host : 'localhost', | |
user : 'root', |
<% | |
File imageDirectory = new File("./images"); | |
String images[] = imageDirectory.list(); | |
if(images != null){ | |
int imageNumber = 0; | |
double randomNumber = Math.random(); | |
int random2Digits = (int)(randomNumber * 100); | |
for(int i = 0; i < random2Digits; i++){ |