#HTMLQuiz what happens?
<iframe id=x></iframe>
<script>
x.contentDocument.body.appendChild(x);
</script>
- wild DOMException appears
- iframe escapes
SC._detectBrowser = function(userAgent, language) { | |
var version, webkitVersion, browser = {}; | |
userAgent = (userAgent || navigator.userAgent).toLowerCase(); | |
language = language || navigator.language || navigator.browserLanguage; | |
version = browser.version = (userAgent.match(/.*(?:rv|chrome|webkit|opera|ie)[\/: ](.+?)([ \);]|$)/) || [])[1]; | |
webkitVersion = (userAgent.match(/webkit\/(.+?) /) || [])[1]; | |
browser.windows = browser.isWindows = !! /windows/.test(userAgent); | |
browser.mac = browser.isMac = !! /macintosh/.test(userAgent) || (/mac os x/.test(userAgent) && !/like mac os x/.test(userAgent)); | |
browser.lion = browser.isLion = !! (/mac os x 10_7/.test(userAgent) && !/like mac os x 10_7/.test(userAgent)); | |
browser.iPhone = browser.isiPhone = !! /iphone/.test(userAgent); |
// Pre-requisites: | |
// 1. Device core plugin | |
// 2. Splashscreen core plugin (3.1.0) | |
// 3. config.xml: <preference name="AutoHideSplashScreen" value="false" /> | |
// 4. config.xml: <preference name="DisallowOverscroll" value="true" /> | |
function onDeviceReady() { | |
if (parseFloat(window.device.version) >= 7.0) { | |
document.body.style.marginTop = "20px"; | |
// OR do whatever layout you need here, to expand a navigation bar etc |
<?php | |
// Prevent content sniffing attacks such as http://mths.be/bst. | |
header('X-Content-Type-Options: nosniff'); | |
// Note: The user-provided callback name must be filtered to prevent attack | |
// vectors. This script simply removes any symbols other than `[a-zA-Z0-9$_]` | |
// from the input. Sadly, this blocks the use of some valid JavaScript | |
// identifiers, and also accepts a few invalid ones. See | |
// http://mathiasbynens.be/notes/javascript-identifiers for details. |
#HTMLQuiz what happens?
<iframe id=x></iframe>
<script>
x.contentDocument.body.appendChild(x);
</script>
- wild DOMException appears
- iframe escapes
(function (undefined) { | |
/** | |
* moment.easter | |
* Source: https://github.com/zaygraveyard/moment-easter | |
* License: MIT | |
*/ | |
moment.easter = function Easter20ops(year) { | |
var a = (year / 100 | 0) * 1483 - (year / 400 | 0) * 2225 + 2613; | |
var b = ((year % 19 * 3510 + (a / 25 | 0) * 319) / 330 | 0) % 29; | |
var c = 148 - b - ((year * 5 / 4 | 0) + a - b) % 7; |
/* | |
Theme Name: Twenty Sixteen Child Theme | |
Theme URI: https://2016.wpcampus.org/schedule/wordpress-masterclass/ | |
Description: A Twenty Sixteen child theme | |
Author: Morten Rand-Hendriksen | |
Author URI: https://lynda.com/mor10 | |
Template: twentysixteen | |
Version: 1.0.0 | |
License: GNU General Public License v2 or later | |
License URI: http://www.gnu.org/licenses/gpl-2.0.html |
<?php | |
// Enqueue the parent theme stylesheet, then the child theme stylesheet. | |
// Used in place of @import rule in child theme style.css | |
function child_theme_name_enqueue_styles() { | |
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); | |
wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( 'parent-style' ) ); | |
} | |
add_action( 'wp_enqueue_scripts', 'child_theme_name_enqueue_styles' ); |
#!/usr/bin/env node | |
/* -*- js2 -*- */ | |
/* ************************************************************* */ | |
// Set up classes to support Range objects. Ported from | |
// Nagios::Plugin::Range. See named functions below. | |
// TODO: Modularize properly/idiomatically. | |
/* | |
* Represents a Nagios plugin range object. |
var path = require('path'); | |
var Nightmare = require('nightmare'); | |
var should = require('chai').should(); | |
describe('Nightmare demo', function () { | |
this.timeout(15000); // Set timeout to 15 seconds, instead of the original 2 seconds | |
var url = 'http://localhost:3000'; | |
describe('Start page', function () { |