#HTMLQuiz what happens?
<iframe id=x></iframe>
<script>
x.contentDocument.body.appendChild(x);
</script>
- wild DOMException appears
- iframe escapes
function decodeUrlParameter(str) { | |
return decodeURIComponent((str+'').replace(/\+/g, '%20')); | |
} |
#HTMLQuiz what happens?
<iframe id=x></iframe>
<script>
x.contentDocument.body.appendChild(x);
</script>
- wild DOMException appears
- iframe escapes
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
import React, { Component } from "react"; | |
import { Text } from "react-native"; | |
import { Provider, connect } from "react-redux"; | |
import { StackNavigator, addNavigationHelpers } from "react-navigation"; | |
import Routes from "./config/routes"; | |
import getStore from "./store"; | |
const AppNavigator = StackNavigator(Routes); |
/* | |
* THIS IS NOT A PLUGIN | |
* ~ but a personal snippet | |
* | |
* Sometimes when prototyping my designs, I like to get dummy data pretty fast. | |
* I use this snippet to extract that data from working (aka "real life") tables from other HTML tables I find on the net. | |
* So I'll need that same data but inside an object. | |
* | |
* This script assumes by default the table has the following structure: | |
* <table> |
function slugify(string) { | |
const a = 'àáäâãåèéëêìíïîòóöôùúüûñçßÿœæŕśńṕẃǵǹḿǘẍźḧ·/_,:;' | |
const b = 'aaaaaaeeeeiiiioooouuuuncsyoarsnpwgnmuxzh------' | |
const p = new RegExp(a.split('').join('|'), 'g') | |
return string.toString().toLowerCase() | |
.replace(/\s+/g, '-') // Replace spaces with - | |
.replace(p, c => b.charAt(a.indexOf(c))) // Replace special characters | |
.replace(/&/g, '-and-') // Replace & with 'and' | |
.replace(/[^\w\-]+/g, '') // Remove all non-word characters |
<html> | |
<head> | |
<title>Google Maps Multiple Markers</title> | |
<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script> | |
</head> | |
<body> | |
<div id="map" style="height: 400px; width: 500px;"> | |
</div> | |
<script type="text/javascript"> |
CloudFlare is an awesome reverse cache proxy and CDN that provides DNS, free HTTPS (TLS) support, best-in-class performance settings (gzip, SDCH, HTTP/2, sane Cache-Control
and E-Tag
headers, etc.), minification, etc.
I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.
If you want to roll up all of these into a single jQuery plugin check out Sharrre
Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.