This file contains hidden or 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
#news { background: #666; color: #fff; padding: 4px 0; width: 100%; height: 30px; line-height: 30px; overflow: hidden; } | |
#news .container { float: left; } | |
#news .overflow { width: 900000px; } | |
#news .item { padding: 0 20px; } |
This file contains hidden or 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
.TooltipContainer { position: absolute; z-index: 100; font-size: 10px; display: none; background: #333; color: #fff; -moz-border-radius: 3px; -webkit-border-radius: 3px; -o-border-radius: 3px; -ms-border-radius: 3px; border-radius: 3px; box-shadow: 0 2px 5px 0 rgba(0,0,0, .4); } | |
.TooltipContainer .arrow { position: absolute; bottom: -4px; left: 15px; z-index: 1950; background: #333; height: 10px; width: 10px; -webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); } | |
.TooltipContainer .content { padding: 5px; position: relative; z-index: 2000; } |
This file contains hidden or 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
c_cyan=`tput setaf 6` | |
c_red=`tput setaf 1` | |
c_green=`tput setaf 2` | |
c_sgr0=`tput sgr0` | |
parse_git_branch () | |
{ | |
if git rev-parse --git-dir >/dev/null 2>&1 | |
then | |
gitver=$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p') |
This file contains hidden or 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 parseTweet(text) { | |
return text.replace(/[\w]+:\/\/[\w\d-]+\.[\w\d-:%&~\?\/.=]+/gi, function(url) { | |
return url.link(url); | |
}).replace(/[@]+[\w\d-]+/gi, function(u) { | |
return u.link("http://twitter.com/"+u.replace("@","")); | |
}).replace(/[#]+[\w\d-]+/gi, function(t) { | |
return t.link("http://search.twitter.com/search?q="+t.replace("#","%23")); | |
}); | |
} |
This file contains hidden or 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 easings = { | |
bacon: function(pos) { | |
return 1 - (Math.cos(pos * 2 * Math.PI) * Math.exp(-pos * 5)); | |
} | |
}; |
This file contains hidden or 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 foo = Math.PI; | |
Number(foo); | |
parseInt(foo, 10); |
This file contains hidden or 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 foo = Math.PI; | |
//Most common | |
Math.floor(foo); | |
//Double bitwise NOT | |
~~foo; | |
//Bitwise OR | |
foo | foo; |
This file contains hidden or 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 reverse(input){ | |
return '‮'+input; | |
} | |
document.body.innerHTML = reverse('this is a test') |
This file contains hidden or 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
Debounce | |
Debouncing is a way of ensuring that a function is only called once when fired multiple times in a short period. Almost all keyboards have some form of built in debouncing since the keys will hit the sensor quite a few times per keystroke. For keyboards, the delay is somewhere around 50ms. | |
In Javascript, debouncing is important for rapidly firing events, such as text input. Instead of firing a keydown event and processing input data on every keypress, you fire the event once after no more keypresses are detected in a certain amount of time. | |
-- | |
Scoring: | |
1 point for correctly working solution |
This file contains hidden or 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
<html> | |
<body onload="onLoad()"> | |
<script> | |
function onLoad(){ | |
var UserInput = document.getElementById('UserInput'); | |
var UserOutput = document.getElementById('UserOutput'); | |
//YOUR CODE HERE | |
Function.prototype.debounce = function(delay_period) { |