Skip to content

Instantly share code, notes, and snippets.

@yamakuzuryu
yamakuzuryu / AngularWatches.js
Created December 4, 2015 07:05
prints out how many watches are on a page
// prints out how many watches are on a page
(function () {
var root = angular.element(document.getElementsByTagName('html'));
var watchers = [];
var f = function (element) {
angular.forEach(['$scope', '$isolateScope'], function (scopeProperty) {
if (element.data() && element.data().hasOwnProperty(scopeProperty)) {
angular.forEach(element.data()[scopeProperty].$$watchers, function (watcher) {
setInterval(function() { Array.prototype.slice.call(document.querySelectorAll('[data-reactid]')).forEach(function(element) { element.style.outline = '1px solid rgba(255,0,0,0.1)'; }) }, 500)
/*
* This code allows you to use console.x() functions in case they make it into production
* and/or into browsers that don't support them.
*/
(function(global){
var prod = global.location.href.match(/^http:\/\/(www\.)?[domainname]/i) !== null,
api = ["log","debug","info","warn","error","assert","dir","dirxml", "trace","group","groupCollapsed","groupEnd","time","timeEnd", "profile","profileEnd","count","exception","table"],
log, i, len;
if (typeof global.console == "undefined" || !global.console) {
white-space: pre; /* CSS 2.0 */
white-space: pre-wrap; /* CSS 2.1 */
white-space: pre-line; /* CSS 3.0 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: -moz-pre-wrap; /* Mozilla */
white-space: -hp-pre-wrap; /* HP Printers */
word-wrap: break-word; /* IE 5+ */
-webkit-hyphens: auto;
-moz-hyphens: auto;
-o-hyphens: auto;
-ms-hyphens: auto;
hyphens: auto;
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
// prevent ios from zooming onfocus - jquery mobile version
( function( $ ) {
var meta = $( "meta[name=viewport]" ),
initialContent = meta.attr( "content" ),
disabledZoom = initialContent + ",maximum-scale=1, user-scalable=no",
enabledZoom = initialContent + ",maximum-scale=10, user-scalable=yes",
disabledInitially = /(user-scalable[\s]*=[\s]*no)|(maximum-scale[\s]*=[\s]*1)[$,\s]/.test( initialContent ),
preventFocusZoom = /iPhone|iPad|iPod/.test( navigator.platform ) && navigator.userAgent.indexOf( "AppleWebKit" ) > -1;
$.mobileZoom = $.extend( {}, {
/* prevent ios from zooming onfocus
http://nerd.vasilis.nl/prevent-ios-from-zooming-onfocus/
*/
var $viewportMeta = $('meta[name="viewport"]');
$('input, select, textarea').bind('focus blur', function(event) {
$viewportMeta.attr('content', 'width=device-width,initial-scale=1,maximum-scale=' + (event.type == 'blur' ? 10 : 1));
});
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
@yamakuzuryu
yamakuzuryu / meta: web app capable
Created May 14, 2013 18:16
remove top bar on bookmarked sites
<meta name="apple-mobile-web-app-capable" content="yes">