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
var r = 19, Robot = function(e) { | |
this.data = {}, this.time = 0, this.arenaTopLeft = {x: r,y: r}, this.arenaTopRight = {x: e.arenaWidth - r,y: r}, this.arenaBottomLeft = {x: r,y: e.arenaHeight - r}, this.arenaBottomRight = {x: e.arenaWidth - r,y: e.arenaHeight - r}, this.arenaCenter = {x: e.arenaWidth / 2,y: e.arenaHeight / 2}, this.target1 = null, this.target2 = null | |
}, p = Robot.prototype; | |
(function() { | |
var e = r, t = r * r, n = 20, i = 2, s = 50, o = 50; | |
p.sub = function(e, t) { | |
return {x: e.x - t.x,y: e.y - t.y} | |
}, p.add = function(e, t) { | |
return {x: e.x + t.x,y: e.y + t.y} | |
}, p.neg = function(e) { |
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
// Extend JW Player instance with Backbone Events | |
// binds jw events to trigger using lowercase names 'ready', 'play', 'time', etc... | |
// allows us to add and remove listers using 'on', 'off', 'once', etc... | |
// Requires jwplayer.js and Backbone.js (which includes underscore) | |
// For more info see: http://backbonejs.org/#Events | |
// and http://support.jwplayer.com/customer/portal/articles/1413089-javascript-api-reference | |
// IMPORTANT: define listeners in the same scope as the new jw instance returned by setup |
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
// audio-levels.js | |
// https://github.com/bgrins/devtools-snippets | |
// Print out audio levels for all video / audio elements on the page. | |
// Watch out for: "MediaElementAudioSource outputs zeroes due to CORS access restrictions" ...for x-origin media urls | |
(function() { | |
[].forEach.call(document.querySelectorAll("video,audio"), function(media) { | |
var splitPath = media.src.split('/'); |
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
# history options | |
export HISTCONTROL=erasedups | |
export HISTSIZE=10000 | |
export HISTIGNORE='&:ls:[bf]g:' | |
shopt -s histappend | |
export COMMAND_MODE=unix2003 | |
# colors for misc things |
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> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Buffering</title> | |
<style> | |
.ranges { | |
height: 20px; | |
position: relative; | |
width: 400px; |
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
/* | |
This script extends jwplayer api instances with a `_history` | |
property which is a hash of event types including "all". | |
After including this on the page, to check if a "play" event fired, | |
call `jwplayer()._history.play`. Initially this returns `undefined`. | |
Once the event is fired an array is populated with an object for each | |
event fired. | |
The `jwplayer()._history.all` array will always be present and contains |
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
var r = 19;//Math.ceil(Math.sqrt(27 * 27 + 24 * 24)/2); // Tank Dimensions: 27, 24 | |
var Robot = function(robot) { | |
this.data = {}; | |
// MOVE_INCREMENT = 1, ANG_INCREMENT = 1; | |
this.time = 0; | |
this.arenaTopLeft = {x: r, y: r}; | |
this.arenaTopRight = {x: robot.arenaWidth -r, y: r}; | |
this.arenaBottomLeft = {x: r, y: robot.arenaHeight -r}; |
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
var r = 19, Robot = function(e) { | |
this.data = {}, this.time = 0, this.arenaTopLeft = {x: r,y: r}, this.arenaTopRight = {x: e.arenaWidth - r,y: r}, this.arenaBottomLeft = {x: r,y: e.arenaHeight - r}, this.arenaBottomRight = {x: e.arenaWidth - r,y: e.arenaHeight - r}, this.arenaCenter = {x: e.arenaWidth / 2,y: e.arenaHeight / 2}, this.target1 = null, this.target2 = null | |
}, p = Robot.prototype; | |
(function() { | |
var e = r, t = r * r, n = 20, i = 2, s = 50, o = 50; | |
p.sub = function(e, t) { | |
return {x: e.x - t.x,y: e.y - t.y} | |
}, p.add = function(e, t) { | |
return {x: e.x + t.x,y: e.y + t.y} | |
}, p.neg = function(e) { |
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
var r = 19, Robot = function(e) { | |
this.data = {}, this.time = 0, this.arenaTopLeft = {x: r,y: r}, this.arenaTopRight = {x: e.arenaWidth - r,y: r}, this.arenaBottomLeft = {x: r,y: e.arenaHeight - r}, this.arenaBottomRight = {x: e.arenaWidth - r,y: e.arenaHeight - r}, this.arenaCenter = {x: e.arenaWidth / 2,y: e.arenaHeight / 2}, this.target1 = null, this.target2 = null | |
}, p = Robot.prototype; | |
(function() { | |
var e = r, t = r * r, n = 20, i = 2, s = 50, o = 50; | |
p.sub = function(e, t) { | |
return {x: e.x - t.x,y: e.y - t.y} | |
}, p.add = function(e, t) { | |
return {x: e.x + t.x,y: e.y + t.y} | |
}, p.neg = function(e) { |
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
#!/usr/local/bin/ruby | |
grep = `git grep -n #{ARGV[0]} #{ARGV[1]}` | |
files = grep.scan /.*\:\d+/ | |
interrupt = false | |
files.each do |file_with_line| | |
exit if interrupt |