Skip to content

Instantly share code, notes, and snippets.

View sprzybylski's full-sized avatar

Szymon Przybylski sprzybylski

View GitHub Profile
const data = [
"123 328 51 64 ",
" 45 64 387 23 ",
" 6 98 215 314",
"* + * + ",
];
const len = data.length;
let total = 0;
let subTotal = 0;
const input = [
{ start: "11", end: "22" },
{ start: "95", end: "115" },
{ start: "998", end: "1012" },
{ start: "1188511880", end: "1188511890" },
{ start: "222220", end: "222224" },
{ start: "1698522", end: "1698528" },
{ start: "446443", end: "446449" },
{ start: "38593856", end: "38593862" },
{ start: "565653", end: "565659" },
const input = ["L68", "L30", "R48", "L5", "R60", "L55", "L1", "L99", "R14", "L82"];
let pointer = 50;
const result = input
.map((instruction) => {
const direction = instruction.charAt(0);
const distance = parseInt(instruction.slice(1), 10);
return { direction, distance };
})
.reduce((acc, { direction, distance }) => {
const toMove = distance % 100;
<?xml version='1.0' encoding='utf-8'?>
<SHOP>
<SHOPITEM>
<ITEM_ID>PUMA-001</ITEM_ID>
<PRODUCTNAME>Puma tenisky - Velikost 36</PRODUCTNAME>
<DESCRIPTION>&lt;p&gt;Stylové a pohodlné tenisky Puma pro každodenní nošení.&lt;/p&gt;</DESCRIPTION>
<PRODUCT>Puma tenisky, velikost 36, barva: černá</PRODUCT>
<IMGURL>https://picsum.photos/400/500</IMGURL>
<EAN>4066748333578</EAN>
</SHOPITEM>
var view = new CounterView({
collection: new NotificationsCollection()
});
this.spy(view, 'render');
view.collection.add([{}]);
assert(view.render.calledOnce);
var ListCollection = Backbone.Collection.extend({
model: Bid,
comparator: function (bid) {
return -(new Date(bid.get('date'))).getTime();
},
sortASC: function (key) {
return this.sortBy(function (model) {
return model.get(key);
jshint: {
options: {
"browser": true,
"node": false,
..
"maxlen": 80,
globals: {
myBrowserGlobal: true
},
reporters: [
@sprzybylski
sprzybylski / robot.js
Created December 7, 2012 07:53
Bazinga
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
@sprzybylski
sprzybylski / gist:3796731
Created September 27, 2012 22:05
PHP WAT!
<?php
$a = 0;
$b = 'x';
var_dump(FALSE == $a);
var_dump($a == $b);
var_dump($b == TRUE);
?>
info: Welcome to Nodejitsu chazm
info: jitsu v0.9.8
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Analyzing application dependencies in app.js
/usr/local/lib/node_modules/jitsu/node_modules/require-analyzer/node_modules/npm/lib/npm.js:299
if (!conf.hasOwnProperty("prefix")) {
^
TypeError: Object #<error> has no method 'hasOwnProperty'