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
<snippet> | |
<content><![CDATA[ | |
describe("${1:Subject}", function(){ | |
${2:// Your code goes here.} | |
}); | |
]]></content> | |
<tabTrigger>describe</tabTrigger> | |
</snippet> |
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
// Get the model's index by id or fall back to underscore's method | |
indexOf: function(sought) { | |
if (typeof sought === "string") { | |
if (!this._byId[sought]) { | |
return -1; | |
}; | |
if (_.indexOf.call(_, this.pluck('id'), sought) !== -1) { | |
return _.indexOf.call(_, this.pluck('id'), sought) | |
} | |
return _.pluck(this.models, 'cid').indexOf(sought) |
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
// Set up ajax Interceptors | |
app.factory('myHttpInterceptor', ["$q", "$rootScope",function ($q, $rootScope) { | |
return { | |
'request': function(config) { | |
// do something on success | |
$rootScope.$broadcast('request') | |
console.log(config) | |
return config | |
}, |
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 to convert hue, saturation, lightness in browser | |
* @param {integer} h in range of 0..360 | |
* @param {saturation} s in range of 0..100 (percents) | |
* @param {lightness} l in range of 0..100 (percents) | |
* @return {array} array [r, g, b] of integers (0..255) representing each part | |
*/ | |
hsl2rgb = function (h, s, l) { | |
var transmitter = document.createElement("div"); | |
hsl2rgb = function () { |
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
// from http://vvsite.com.ua/?attachment_id=783 | |
//<!-- | |
var cifir_ru= new Array("од","дв","три","четыр","пят","шест","сем","восем","девят"); | |
var sotN_ru=new Array("сто","двести","триста","четыреста","пятьсот","шестьсот","семьмот","восемьсот","девятьсот"); | |
var milion_ru=new Array("триллион","миллиард","миллион","тысяч"); | |
var anDan_ru =new Array("","","","сорок","","","","","девяносто"); | |
function SPRU(XS){ | |
(XS>0? this.XS=sumPROPRU(Math.floor(XS),Math.round((XS-Math.floor(XS))*100)) : this.XS="Пусто!" ); | |
return this; |
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
require './calculator_class' | |
puts "Enter numbers divided by spaces" | |
begin | |
# chop is used to get rid of '\n' new char line that's the last one in gets when finishing line input | |
numbers = gets.chop.split.grep(/-?\d+/) do |possible_num| | |
begin | |
# unlike to_i, Integer throws exception if input is somehow invalid (letters, etc) | |
Integer(possible_num) |
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
// escaping .^$*+?()[{\| | |
separator = separator.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); |
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
@font-face { | |
font-family: 'Lobster'; | |
font-style: normal; | |
font-weight: 400; | |
src: local('Lobster'), url(http://themes.googleusercontent.com/static/fonts/lobster/v5/vAXzwlQm5f2XqUwV0l0P2w.woff) format('woff'); | |
} | |
@font-face { | |
font-family: 'Goudy Bookletter 1911'; | |
font-style: normal; |
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
describe("E2E: Testing Routes", function() { | |
console.log('this e2e ran') | |
beforeEach(function() { | |
browser().navigateTo('/'); | |
}); | |
it('should jump to the /videos path when / is accessed', function() { | |
browser().navigateTo('/#/'); | |
expect(browser().location().hash()).toBe("#/chart/demographics"); | |
}); |
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
Write (pure) HTML code for home page for some abstract project. | |
It should have: | |
1. navigation menu that has several anchored links that are pointing to different sections on page ('#about, '#faq', '#contacts', '#register') | |
2. several sections: | |
a) about: section that has a large copy of text , several paragraphs with description of product, possibly, a large image to capture attention | |
b) faq: list of frequently asked questions | |
b) contacts: some addresses (email-phones), blogs-twitter, etc. | |
c) register: form that captures email/password/password confirmation | |
d) feedback form? |