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 makeSnow($n) | |
$value: '#{random(2000)}px #{random(2000)}px rgba(255, 255, 255, .9)' | |
@for $i from 2 through $n | |
$value: '#{$value} , #{random(2000)}px #{random(2000)}px rgba(255, 255, 255, .9)' | |
@return unquote($value) | |
$snow-small: makeSnow(700) | |
$snow-medium: makeSnow(500) |
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
{ | |
"type": [{ | |
"CS": [{ | |
"Pixels of Fury": { | |
"type": "damage", | |
"power": 1 | |
}, | |
"Critique": { | |
"type": "damage", | |
"power": 1 |
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
/* | |
You are given a string s composed of letters and numbers, which was compressed with some algorithm. | |
Every letter in s is followed by a number (possibly with leading zeros), | |
which represents the number of times this letter occurs consecutively. For example, "aaaaaaaabbbbbbcc" | |
would be given as "a8b6c2". | |
*/ | |
Expand_It = (s, k) => s.split(/(\d+|\D+)/g).filter(n => !!n).map( (v, i, a) => v.repeat( a[i+1] ) ).sort().join("")[k-1] |
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
/* | |
You are given an array of integers ARR and an integer SUM. | |
Your task is to find the number of subsets of the array ARR, such that the sum of their elements equals SUM | |
Example: | |
SubsetSum([1,2,3,4,5], 5) = 3 | |
These subsets are [1,4], [2,3] and [5]. | |
SubsetSum([1,2,3,4,-5], 0) = 3 |
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
GoldMineRace = (c, s, g) => { | |
a = [] | |
c.forEach( (e, i) => { | |
x = c[i][0]-g[0] | |
y = c[i][1]-g[1] | |
a[i] = Math.sqrt(x*x + y*y)/s[i] | |
}) | |
return a.indexOf( a.slice().sort( (a,b) => a-b ).filter( (n, p, s) => n != s[p+1] && n!= s[p-1] )[0] ) | |
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
/* | |
Sheldon, Leonard, Penny, Rajesh and Howard are in the queue for a "Double Cola" drink vending machine; | |
there are no other people in the queue. The first one in the queue (Sheldon) buys a can, drinks it and doubles! | |
The resulting two Sheldons go to the end of the queue. | |
Then the next in the queue (Leonard) buys a can, drinks it and gets to the end of the queue as two Leonards, and so on. | |
For example, Penny drinks the third can of cola and the queue will look like this: | |
[Rajesh, Howard, Sheldon, Sheldon, Leonard, Leonard, Penny, Penny] | |
Write a program that will return the name of a man who will drink the n-th cola. |
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 allianceVersusMonster(healthPoints, attackDamage) { | |
var warriors = []; | |
var monsterAttack = attackDamage[0]; | |
var monsterLife = healthPoints[0]; | |
var monsterIsDead = false; | |
var partyNum = healthPoints.length - 1; | |
var equalStats = false | |
//Warrior Template |
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
// Portfolio.load(page) | |
// Loads a requested page | |
// Decides whether the page requested | |
// needs just a preview pane update | |
// a grid update or both | |
// @public | |
// @param {String} page - the page being requested | |
// @param {Boolean} addHistory - Do we need a new history state? | |
var Load = (function(page, addHistory) { |
NewerOlder