Skip to content

Instantly share code, notes, and snippets.

View krfong916's full-sized avatar
🦁
Organizing for a brighter future

Kyle Fong krfong916

🦁
Organizing for a brighter future
  • University of California, Santa Cruz
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
@krfong916
krfong916 / gist:2a4a0a7429612a3b64b01bd1e64e8012
Created November 13, 2018 23:59
lexical this and this properties
// lexical this and this properties
function test() {
setTimeout(() => {
console.log(this.a)
}, 1000);
}
let a = 2;
test();
@krfong916
krfong916 / object_prototype_constructor_call.js
Created November 30, 2018 05:39
Ways not to instantiate an object
function sideEffects() {
console.log("this will have a side effect because thats how the object prototype mechanism just works");
}
function Bar () {
console.log(`hey no side effects, we're all good!`);
}
Bar.prototype = new sideEffects();
@krfong916
krfong916 / prototypal_object_creation_1.js
Created November 30, 2018 06:41
prototypal object creation with change of property
function sideEffects() {
console.log("this will have a side effect because thats how the object prototype mechanism just works");
}
var User = function({first_name, last_name, language, num_friends, num_reports, college, active}) {
var obj = Object.create(User.prototype)
obj.first_name = first_name
obj.last_name = last_name
obj.language = language
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.3.1/redux.js"></script>
<script src="https://fb.me/react-with-addons-0.14.7.js"></script>
<script src="https://fb.me/react-dom-0.14.7.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-redux/4.4.0/react-redux.js"></script>
<link href='https://fonts.googleapis.com/css?family=Open+Sans:600,700' rel='stylesheet' type='text/css'>