Angular doesn’t depend on jQuery. In fact, the Angular source contains an embedded lightweight alternative: jqLite. Still, when Angular detects the presence of a jQuery version in your page, it uses that full jQuery implementation in lieu of jqLite. One direct way in which this manifests itself is with Angular’s element abstraction. For example, in a directive you get access to the element that the directive applies to:
This file contains hidden or 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
| # Based on the book 'Lightweight Django' | |
| # by Mark Lavin & Julia Elman | |
| # See the following Repo for this example broken into multiple files. | |
| # https://github.com/richardadalton/djangolight | |
| from django.core.management import execute_from_command_line | |
| from django.conf import settings | |
| from django.conf.urls import url | |
| from django.http import HttpResponse |
This file contains hidden or 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
| """A very basic url-based chat""" | |
| from flask import Flask, redirect | |
| app = Flask(__name__) # the flask application object | |
| messages = ['System: Hi everyone'] # a global object for all chat messages | |
| def all_messages(): | |
| """Helper function to get a string of all chat messages, one per line""" | |
| return '<br>'.join(messages) |
This file contains hidden or 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
| """A very basic url-based chat""" | |
| from flask import Flask, redirect | |
| app = Flask(__name__) # the flask application object | |
| messages = ['System: Hi everyone'] # a global object for all chat messages | |
| def all_messages(): | |
| """Helper function to get a string of all chat messages, one per line""" | |
| return '<br>'.join(messages) |
This file contains hidden or 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
| set -e # we exit on error, but otherwise all the commands are quiet | |
| sudo pip -q install virtualenvwrapper | |
| grep -q 'VIRTUALENV_PYTHON' ~/.bashrc || (echo 'export VIRTUALENV_PYTHON=/usr/bin/python3' >>~/.bashrc) | |
| grep -q 'virtualenvwrapper.sh' ~/.bashrc || (echo 'source /usr/local/bin/virtualenvwrapper.sh' >>~/.bashrc) | |
| grep -q 'Welcome to your Code Institute' ~/.bashrc || (echo 'echo "Hi $C9_USER, welcome to your Code Institute Python workspace in c9, remember to use the mkvirtualenv and workon commands for your projects"' >>~/.bashrc) | |
| source ~/.bashrc |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Tab closing in JS</title> | |
| <script > | |
| function openTab() { | |
| open(location.href+"#jsopened"); | |
| } | |
| function closeTab() { | |
| if (location.hash.endsWith("jsopened")) { |
This file contains hidden or 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 functools import lru_cache | |
| @lru_cache(maxsize=1000) | |
| def coincount(coinlist, amount): | |
| if not amount: | |
| return 1 | |
| if not coinlist: | |
| return 0 |
This file contains hidden or 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
| Afghanistan | |
| Albania | |
| Algeria | |
| Angola | |
| Antarctica | |
| Argentina | |
| Armenia | |
| Australia | |
| Austria | |
| Azerbaijan |
This file contains hidden or 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
| // Go to the Class Profiles page in your desktop browser (doesn't matter which one you use): | |
| // https://sisweb.ucd.ie/usis/W_HU_REPORTING.P_DISPLAY_QUERY?p_code1=B036Y1&p_query=OB200-1 | |
| // Open the developer tools console, every browser has a slightly different way to open it | |
| // Paste the following into it, and then close it. | |
| // From now on, pressing the Spacebar will toggle the visibiltiy of the names on the page. | |
| // This only applies to that particular session, and will be forgotten when you reopen the page. | |
| $(document).keypress(function(event) { | |
| if (event.keyCode == 32) { // Spacebar |
This file contains hidden or 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 extractRespondentAnswers(respondentElem) { | |
| let answers = Array.from(respondentElem.querySelectorAll('.response-text')); | |
| return answers | |
| .map(elem => | |
| elem.parentElement.parentElement.parentElement.parentElement.parentElement | |
| .querySelector('.response-question-title-text').innerText | |
| + (elem.previousElementSibling ? ">" + elem.previousElementSibling.innerText : "") | |
| + '\t' + elem.innerText | |
| ).join('\n'); |
OlderNewer