This file contains 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
// Open Dev Tools console and enter | |
!(function a(){ debugger; }()); | |
// Then you should see the wrapping | |
with ((console && console._commandLineAPI) || {}) { | |
!(function a(){ debugger;}()) | |
} |
This file contains 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
// dollar selector | |
function $(C, P) { | |
P = P || document; | |
return /:first$/.test(C) ? (P = P.querySelector(C.slice(0, -6))) ? [P] : [] : [].slice.call(P.querySelectorAll(C)) | |
} | |
// simple utility to add an event listener | |
$.on = function (CSS, parentNode, type, handler, capture) { | |
// in case parentNode is missing | |
if (typeof type !== 'string') { |
This file contains 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> | |
<title>Animations</title> | |
<body> | |
<script> | |
function createAndAnimate(part) { | |
var element = document.createElement('pre'); | |
element.textContent = part; | |
document.body.appendChild(element); | |
element.animate( |
This file contains 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(angular) { | |
angular.module('analytics', ['ng']).service('analytics', [ | |
'$rootScope', '$window', '$location', function($rootScope, $window, $location) { | |
var track = function() { | |
$window._gaq.push(['_trackPageview', $location.path()]); | |
}; | |
$rootScope.$on('$viewContentLoaded', track); | |
} | |
]); |
This file contains 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
Sinatra::Application.routes["GET"].each do |route| | |
before do | |
// All the things | |
end | |
end |
This file contains 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
// register the service worker | |
navigator.serviceWorker.register('/worker.js').then( | |
function(reg) { console.log('Installed successfully', reg) }, | |
function(err) { console.log('Worker installation failed', err) } | |
); | |
// ... worker.js | |
self.addEventListener('fetch', function(event) { | |
var requestURL = new URL(event.request); |
This file contains 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 Words(str) { | |
this._str = str; | |
} | |
Words.prototype[Symbol.iterator] = function() { | |
var re = /\S+/g; | |
var str = this._str; | |
return { | |
next: function() { |
This file contains 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
#!/bin/bash | |
# Delete all containers | |
docker rm $(docker ps -a -q) | |
# Delete all images | |
docker rmi $(docker images -q) |
This file contains 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
# is the last run container still running? | |
docker inspect --format '{{.State.Running}}' $(docker ps -lq) |
This file contains 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
# Shutdown local node | |
curl -XPOST 'http://localhost:9200/_cluster/nodes/_local/_shutdown' | |
# Shutdown all nodes in the cluster | |
curl -XPOST 'http://localhost:9200/_shutdown' |
OlderNewer