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
| File = Backbone.Model.extend | |
| validate: (args) -> | |
| result | |
| if [email protected](args) | |
| result = 'File already in list' | |
| result | |
| Files = Backbone.Collection.extend | |
| model: File |
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 processURL(url, success){ | |
| var id; | |
| if (url.indexOf('youtube.com') > -1) { | |
| id = url.split('/')[1].split('v=')[1].split('&')[0]; | |
| return processYouTube(id); | |
| } else if (url.indexOf('youtu.be') > -1) { | |
| id = url.split('/')[1]; | |
| return processYouTube(id); | |
| } else if (url.indexOf('vimeo.com') > -1) { |
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 throttle(func, ms) { | |
| var isThrottled = false, | |
| savedArgs, | |
| savedThis; | |
| function wrapper() { | |
| if (isThrottled) { // (2) | |
| savedArgs = arguments; |
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
| $.fn.textWidth = (text, font) -> | |
| if (!$.fn.textWidth.fakeEl) | |
| $.fn.textWidth.fakeEl = $('<span>').css("white-space", "pre").hide().appendTo(document.body) | |
| $.fn.textWidth.fakeEl.text(text or this.val() or this.text()).css('font', font or this.css('font')) | |
| return $.fn.textWidth.fakeEl.width() |
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
| window.uniClick = if (document.ontouchstart isnt null) then 'click' else 'touchstart' |
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
| /* | |
| * object.watch polyfill | |
| * | |
| * 2012-04-03 | |
| * | |
| * By Eli Grey, http://eligrey.com | |
| * Public Domain. | |
| * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. | |
| */ |
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
| //styles | |
| .abs | |
| position absolute | |
| .abs-helper | |
| position relative | |
| white-space nowrap | |
| .abs | |
| top 0 |
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 valuta, sum, uah_kurs, usd_kurs, eur_kurs; | |
| uah_kurs=1; | |
| usd_kurs=1/28; | |
| eur_kurs=1/32; | |
| valuta=prompt('Какую валюту вы хотите обменять? \(usd\, uah или eur\)'); | |
| // if (valuta !== 'usd' || 'USD' || 'uah' || 'UAH' || 'EUR' ||'eur') {alert('Введите валюту в формате USD, UAH или EUR')}; | |
| sum=+prompt('Сколько у вас валюты?'); | |
| switch(valuta) { | |
| case 'usd'||'USD': {alert('Ваши ' + sum + ' ' + valuta + ' равны ' + sum/usd_kurs + ' uah ' + ' или ' + sum/usd_kurs * eur_kurs + ' eur'); break;} | |
| case 'uah'||'UAH': {alert('Ваши ' + sum + ' ' + valuta + ' равны ' + sum*usd_kurs + ' usd ' + ' или ' + sum*eur_kurs + ' eur' ); break;} |
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 fizzbuzz (counter) { | |
| if ((counter % 5 === 0) && (counter % 3 === 0)) return 'fizzbuzz'; | |
| if (counter % 3 === 0) return 'fizz'; | |
| if (counter % 5 === 0) return 'buzz'; | |
| return counter; | |
| } | |
| function consl () { | |
| for (var i = 1; i <= 100; i++){ | |
| console.log(fizzbuzz(i)); |
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
| // http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
| // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
| // requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel | |
| // MIT license | |
| (function() { | |
| var lastTime = 0; | |
| var vendors = ['ms', 'moz', 'webkit', 'o']; |
NewerOlder