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
let numbers = | |
`... snip ...` | |
.split('') | |
.map(n => parseInt(n, 10)) | |
let sum = 0 | |
for (let index = 0; index < numbers.length; index++) | |
if (numbers[index] === numbers[(index + 1) % numbers.length]) | |
sum += numbers[index] |
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 scene import * | |
import sound | |
import random | |
import math | |
class MyScene (Scene): | |
def setup(self): | |
self.background_color = 'midnightblue' | |
self.ship = SpriteNode('spc:PlayerShip1Orange') | |
self.ship.position = self.size / 2 |
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 Character(x, y) { | |
this.movingDirection = 0; | |
this.movesLeft = 0; | |
this.x = x; | |
this.y = y; | |
} | |
Character.prototype = { | |
getX: function() { | |
return this.x_position; | |
}, |
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 requestWithTimeout() { | |
return new Promise((resolve, reject) => { | |
window.setTimeout(() => reject('timeout - request took more than 30 seconds'), THIRTY_SECONDS); | |
makeRequest((err, res) => { | |
if (err) { | |
reject(err); | |
} | |
else { | |
resolve(res); | |
} |
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 transitions = [ "#slider_1", /* ... */ ]; | |
var transitionNext = function () { | |
var next = transitions.shift(); | |
if (!next) { | |
return; | |
} | |
$(next).transition({ |
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
String.prototype.encodeAsPeriods = function () { | |
var characterArray = this.split(''); | |
var charCodeArray = characterArray.map(function (char) { | |
return char.charCodeAt(); | |
}); | |
var periodEncodedCharArray = charCodeArray.map(function (charCode) { | |
var charCodeString = "" + charCode; | |
var digitArray = charCodeString.split(''); | |
var periodStringArray = digitArray.map(function (digitString) { | |
var digit = parseInt(digitString, 10); |