A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.
One-line version to paste in your DevTools
Use $$ if your browser aliases it:
~ 108 byte version
| if ('serviceWorker' in navigator) { | |
| navigator.serviceWorker.register('service-worker.js').then(function(registration) { | |
| // Registration was successful | |
| console.log('ServiceWorker registration successful with scope: ', registration.scope); | |
| registration.pushManager.subscribe().then(function(subscription){ | |
| isPushEnabled = true; | |
| console.log("subscription.subscriptionId: ", subscription.subscriptionId); | |
| console.log("subscription.endpoint: ", subscription.endpoint); | |
| // TODO: Send the subscription subscription.endpoint |
| // non-modular | |
| jQuery.fn.limit = function(count){ | |
| return $(this).filter(function(index){ return index < count; }); | |
| }; | |
| // non-modular usage | |
| $('sel').limit(3); | |
| // modular | |
| var $ = require('jquery'); |
| .row | |
| overflow: hidden | |
| margin-top: 1.5em | |
| &:first-child | |
| margin-top: 0 |
| .column | |
| float: left | |
| margin-left: 5% | |
| &:first-child | |
| margin-left: 0 | |
| &.full | |
| width: 100% |
| .column | |
| float: left | |
| margin-left: 5% | |
| &:first-child | |
| margin-left: 0 | |
| .container | |
| margin: 0 auto | |
| max-width: 960px | |
| width: 90% | |
| *, *:before, *:after | |
| -moz-box-sizing: border-box | |
| -webkit-box-sizing: border-box | |
| box-sizing: border-box | |
| @media xs | |
| .column.full, | |
| .column.two-thirds, | |
| .column.half, | |
| .column.one-third, | |
| .column.one-fourth | |
| float: none; | |
| margin: 0; | |
| width: 100%; | |
| class BottlesOfBeer | |
| def count_off | |
| puts "How many bottles of beer have you got?" | |
| numbers = gets.chomp.to_i | |
| word_bottles = "bottles" | |
| numbers.downto(1) do |number| | |
| puts "\n#{number} #{word_bottles} of beer on the wall" | |
| puts "#{number} #{word_bottles} of beer!" | |
| puts "You take one down and pass it around," |