This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// var btnShow = document.querySelector(".btn-show"); | |
// var box = document.querySelector(".box"); | |
// btnShow.addEventListener("click", () => { | |
// box.classList.toggle("show"); | |
// }); | |
// var allows reassignment which could be harmful if unintentionally did it. | |
// var name = "John"; | |
// var name = "Mike"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*The DOM is a hierachy your browser creates for every webpage | |
<head> and <body> are on the same level (3rd level) | |
*/ | |
// var body = document.getElementsByTagName('body'); | |
// body[0].bgColor = 'blue'; | |
// console.log(body); | |
// var container = document.querySelector('.container'); | |
// container.innerHTML = '<h1>Hello</h1>'; | |
// console.log(container); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isArmstrong(num){ | |
var numStr = num.toString(); | |
var isArmstrongNum = false; | |
var sum = 0; | |
if(numStr.length === 3){ | |
for(var i=0; i < numStr.length; i++) { | |
var n = parseInt(numStr.charAt(i)); | |
sum += Math.pow(n, 3); | |
} | |
if(sum === num) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Objects are containers for named values called properties or methods. | |
Objects are mutable ie its values can be changed other js variables are immutable | |
Objects are passed/called by reference not value | |
eg var obj = {name: "John"}; | |
var x = obj; | |
x.name = "Mike"; This would also change the value of obj.name to "Mike" | |
Primitive data types (number, boolean, string) are passed by value | |
Date, Math, Array, RegExp, etc are all objects | |
NB: Math does not inherit from Object.prototype because it is a global object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyListClass{ | |
String value; | |
List<MyItemClass> items; | |
MyListClass(){} | |
MyListClass.fromRaw(Map value){ | |
value = JSON.decode(value['value']); | |
items = JSON.decode(value['items'],reviver:(k,v){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign Up | |
Credit Card Checkout | |
Landing Page (above the fold) | |
Calculator | |
App Icon | |
User Profile | |
Settings | |
404 page | |
Music Player | |
Social Share |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
watchman watch-del-all && rm -rf node_modules/ && yarn cache clean && yarn install && yarn start -- --reset-cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.apps import AppConfig | |
class ForumConfig(AppConfig): | |
name = 'forum' | |
# This function is the only new thing in this file | |
# it just imports the signal file when the app is ready | |
def ready(self): | |
import your_app_name.signals |
NewerOlder