Skip to content

Instantly share code, notes, and snippets.

@rwangca
rwangca / Eyeballing-This.md
Created Jun 27, 2020 — forked from zcaceres/Eyeballing-This.md
Understanding Binding and 'this' in Javascript
View Eyeballing-This.md

How to Eyeball Your ‘This’ Context in Javascript

The early programmer struggles with the Javascript keyword this. But understanding your this context is easier than it seems.

This is all about where a function is invoked. Often, early programmers worry about where the function was declared. Perhaps the function was declared in a specific file or a particular object. Surely this changes it's this!

Nope.

To understand this, we need to see where it is invoked. Nothing else matters, with one exception which we'll cover in a moment.

View connectThree
package ca.rwang.connectthree;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
View TypingTutor
package a3;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JTextPane;
import java.awt.BorderLayout;
import javax.swing.JPanel;
View sample-three
Column "Movie Title" format a35;
select "Movie Title"
from (select tm.MovieTitle as "Movie Title",
count(tad.MovieID) as "Total Awards"
from tblMovie tm
inner join tblAwardDetail tad on tm.MovieID = tad.MovieID
where tad.AwardResultID = '1'
group by tm.MovieTitle
order by "Total Awards" desc)
View sample-two
Column "Writers Name" format a25;
select tw.WriterFName||' '||tw.WriterLName as "Writers Name"
from tblWriter tw
left outer join tblWriterDetail twd on tw.WriterID = twd.WriterID
where twd.MovieID is null
order by tw.WriterID;
/*
Writers Name
-------------------------
View sample-one
column "Movie" format a30;
select distinct tm.MovieTitle as "Movie"
from tblKeyword tk
inner join (tblKeywordDetail tkd
inner join tblMovie tm on tm.MovieID = tkd.MovieID )
on tkd.KeywordID = tk.KeywordID
where tk.KeywordDesc Like '%France%' OR
tk.KeywordDesc Like '%Pizza%' OR
tk.KeywordDesc Like '%Waitress%'
View DatabaseQuestions
PAUSE Press [RETURN] to see Question 1;
/* 1 */
column "Movie" format a25;
select MovieTitle as "Movie"
from tblMovie
where DirectorID is null;
PAUSE Press [RETURN] to see Question 2 ;
View servo.py
import RPi.GPIO as GPIO
import time
import os
GPIO.setwarnings(False)
# Set the layout for the pin declaration
GPIO.setmode(GPIO.BOARD)
# The pin 11 is the out pin for the PWM signal for the servo.
GPIO.setup(11, GPIO.OUT)
View sensor.py
# Import GPIO Library
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
# Define GPIO pins being used
GPIO_TRIGGER = 18
GPIO_ECHO = 25
#Trig will send out a short burst of sound waves
@rwangca
rwangca / blink.py
Last active Aug 13, 2017
Python Blink Tutorial
View blink.py