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
_.each(dateRange(), function (month) { | |
var beatmaps = osu.getBeatmapsRaw({ | |
since: month | |
}, Meteor.bindEnvironment(function (err, res) { | |
if (err) throw new Meteor.Error(err); | |
var mapsJson = JSON.stringify(res); | |
var maps = JSON.parse(mapsJson); | |
for (var map in maps) { | |
var objectToUpdate = { |
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
Template.myTemplate.viewmodel({ | |
page: new ReactiveVar(0), | |
scrollListener: _.debounce(function () { | |
var self = this; | |
var diff = $(document).height() - $(window).height(); | |
if ($(window).scrollTop() === diff) { | |
self.viewmodel.page().set(self.viewmodel.page().get() + 1); | |
} | |
}, 50); | |
}); |
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
Beatmaps.find().forEach(function(x) { | |
Beatmaps.update({_id: x._id}, { | |
$set: { | |
approved: Number(x.approved), | |
total_length: Number(x.total_length), | |
hit_length: Number(x.hit_length), | |
diff_size: Number(x.diff_size), | |
diff_overall: Number(x.diff_overall), | |
diff_approach: Number(x.diff_approach), | |
diff_drain: Number(x.diff_drain), |
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 nums = [30, 36, 37, 41, 42, 41, 40, 41, 46, 47, 46, 46, 47, 45, 46, 45, 50, 51, 50, 52, 52, 51, 51, 52, 50, 50, 56, 55, 56, 57, 57, 57, 57, 58, 58, 55, 61, 62, 67, 67]; | |
let unique = _.unique(nums); | |
let absoluteFrequency = _.countBy(nums, num => num); | |
let relativeFrequency = () => { | |
let obj = {}; | |
let values = _.values(absoluteFrequency); | |
let keys = _.keys(absoluteFrequency); | |
for (var i = 0; i < keys.length; i++) { | |
obj[keys[i]] = values[i] / nums.length; | |
} |
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
handleQueries(queries, values) { | |
let obj = {}; | |
for (let i = 0; i < queries.length; i++) { | |
obj[queries[i]] = this[queries[i]]() ? values[i] : null; | |
} | |
let vals = _.values(obj).filter(x => x !== null); | |
return vals; | |
} |
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
db.beatmaps.aggregate([ | |
{ | |
"$group": { | |
"_id": "$beatmapset_id", | |
"count": { "$sum": 1 }, | |
"uniqueIds": { "$addToSet": "$_id" }, | |
"maxRating": { "$max": "$difficultyrating" } | |
} | |
}, |
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
arr = [ | |
{ id: 324, difficulty: 3 }, | |
{ id: 324, difficulty: 2 }, | |
{ id: 324, difficulty: 5 }, | |
{ id: 500, difficulty: 3 }, | |
{ id: 500, difficulty: 3.5 }, | |
{ id: 500, difficulty: 7 } | |
]; | |
let map = _.groupBy(arr, (el) => el.id) |
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
const $chat = $('.chat-content'); | |
const $message = $(ReactDOM.findDOMNode(component)); | |
const msgOffset = $message.offset().top; | |
// center the linked message in the chat box | |
const elHeight = $message.height(); | |
const chatHeight = $chat.height(); | |
const offset = msgOffset - ((chatHeight / 2) - (elHeight / 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
const getOffset = (offset, index, arr) => arr[(arr.length + index + (offset % arr.length)) % arr.length] |
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
// ==UserScript== | |
// @name Itunes lower volume | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://itunes.apple.com/*/album/*/*$ | |
// @grant none | |
// ==/UserScript== |
OlderNewer