REPLACE THIS: Please profile using time/timeEnd any potentially time-taking changes. Then profile using node profiler to identify what aspects take most time.
// Nudge for twitter.com for HabitLab | |
// You can use it by installing HabitLab for Chrome, | |
// and then in settings, click Code your own Nudge and paste this code in | |
// TODOS: | |
// Make a version for TweetDeck | |
// Remove nudgeContainer once tweet is successfully sent | |
const $ = require('jquery'); | |
require_component('habitlab-logo-v2'); |
const $ = require('jquery'); | |
require_component('habitlab-logo-v2'); | |
require_component('paper-button'); | |
function removeFeed() { | |
var re = new RegExp('medium.com\/\??.*$'); | |
if (!re.test(window.location.href)) { | |
return; | |
} | |
$('.streamItem').css('display', 'none'); |
/* A bare-bones GithubClient, just used for commits */ | |
function GithubClient(owner, repo, username, passwordOrToken) { | |
this.owner = owner; | |
this.repo = repo; | |
this.username = username; | |
this.passwordOrToken = passwordOrToken; | |
} | |
/* |
A Khan Academy student asked me these questions as part of a school project.
- What is the hardest part about making a website with javascript?
Hmm. It gets tricky once your website starts having a LOT of JavaScript - you have to truly make sure to keep it clean and well organized. Otherwise you end up with what we call "spaghetti code" - a jumble of code that might work but is so hard for you or anyone else to make sense of. It's even more important to organize your code if you're working with other people, so you make sure that you all organize your code the same way and that every bit of code goes in the place it belongs.
Another aspect that can be hard is performance, especially for websites that use a lot of JavaScript. Sometimes the browser slows down when it's trying to execute all the JavaScript, particularly if the code is requesting "repaints" of the browser window - if it's moving or changing visible things on the page. There are now a lot of tools that you can use to analyze the performance o
body { | |
background: rgb(215, 250, 220); | |
font-family: sans-serif; | |
} | |
.header { | |
background-color: rgb(36, 89, 36); | |
color: white; | |
padding: 5px 10px; | |
} |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>New Webpage</title> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.0.0/magnific-popup.css"> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> | |
<script src=" | |
https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.0.0/jquery.magnific-popup.js"></script> | |
<a class="image-link" href="https://www.kasandbox.org/programming-images/animals/butterfly.png">Open popup!</a> |
/** | |
* This function takes in a reference to a DOM element, | |
* assumes each of its children are <img> tags, | |
* and then makes a simple slideshow out of the images. | |
* @param container A DOM element | |
*/ | |
var slideShow = function(container) { | |
this.images = []; | |
this.curImage = 0; | |
for (i = 0; i < container.childElementCount; i++) { |
/* Programming languages | |
Collected by: https://www.khanacademy.org/profile/trekcelt/programs | |
*/ | |
CREATE TABLE languages( | |
id INTEGER PRIMARY KEY, | |
name TEXT, | |
primary_developer TEXT, | |
launched INTEGER, | |
oop INTEGER /* Whether or not they're Object-oriented */ | |
); |
/* | |
1st 3 rounds of the NFL 2015 Draft | |
Collected by: https://www.khanacademy.org/profile/BobbyandKaren/ | |
*/ | |
CREATE TABLE picks( | |
id INTEGER PRIMARY KEY, | |
pick_number INTEGER, | |
name TEXT, | |
college TEXT, |