Skip to content

Instantly share code, notes, and snippets.

@M0N57R0517Y
Created March 15, 2016 01:52
Show Gist options
  • Save M0N57R0517Y/7d6d5fec774f264c7023 to your computer and use it in GitHub Desktop.
Save M0N57R0517Y/7d6d5fec774f264c7023 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="shortcut icon" href="./site-icon.png">
<title>Cubing competition markup creator &middot; /r/Cubers</title>
<link rel="stylesheet" type="text/css" href="sweetalert/sweetalert.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.min.css">
</head>
<body>
<div class="main-form-container">
<form class="main-form" action="" method="post">
<label for="compnum">Competition number:</label>
<input type="number" name="compnum" value="">
<br>
<label for="compdeadline">Competition deadline:</label>
<input type="text" name="compdeadline" value="">
<br>
<label for="compoll">OLL number for this competition:</label>
<input type="number" name="compoll" value="">
<br>
<input type="submit" value="Submit">
<input type="button" class="hide-form" value="Hide this section">
<input type="button" class="edit-comp-button" data-increment="1" value="Next competition">
<input type="button" class="edit-comp-button" data-increment="-1" value="Previous competition">
</form>
<hr/>
</div>
<pre>Hello, and welcome to the /r/cubers weekly competitions! If you're new, please read the entire post before competing! This is competition <span class="compnum">todo_comp_num</span>, and will go until <span class="compdeadline">todo_deadline</span>.
There’s a rotation of 4 events to be held once a month: 5x5, BLD, Skewb, and Pyraminx. You can also request an event to be done! If you want an event in an upcoming competition, write it with your results. One event will be done per week. You must be able to do the event you're requesting.
To compete:
>1. Scramble your cube, in the event that you are doing, with the scrambles provided. For OLL, do the alg 5 times.
>1. Using a timer, such as [cstimer] (http://cstimer.net/timer.php) or [qqtimer] (http://www.qqtimer.net/), time your 5 solves and record the results. You are given up to 15 seconds to inspect the cube for each event.
>1. Post your results following the following format in order for your results to be accepted by the sorting program:
>1. If you have a flair other than the default "Sub-X ...", you must include your username (without /u/) at the top of your results before your first event. If you do not have a flair or have a default, you do not need to include your username. PM /u/PimpedKoala if you have a nondefault flair and are sick of posting your name with the results.
>1. You must copy the events exactly as spelled/capitalized in the post below. Common mistakes (such as 2Gen rather that 2GEN) are recognized by the program, but if it's a unique one (say, Skoob instead of Skewb) then you probably won't get credited for the event.
>1. Follow the event with a colon (:), which is then *directly* followed by the average for the event. After that and before the next event can include anything you'd like, like the times for that event and sidenotes. For instance, your comment could look like:
>1. **10x10: 59.99** // (1:15.67), 1:02.11, 59.12, (56.88), 58.74
>1. That's right. 10x10 in under a minute. Get rekt.
>1. Try to avoid typos in your averages, like accidental commas or decimals in the wrong spot. This can make things pretty ugly. If your times are taken down wrong due to something like this, PM /u/pimpedkoala.
>1. Please put your times in the order they appear on the post, as it makes result taking faster and more accurate!
>1. Competition results are taken 9:00PM EDT Sunday nights, so make sure to submit times by then!
**Weekly Events:**
> * 2x2
> * 3x3
> * 4x4
> * 3x3OH
> * 2GEN
> * LSE
> * OLL
**Weekly Rotation:** (one of these events will be used)
> * 5x5
> * Skewb
> * Pyraminx
> * BLD
**This Week's Bonus Events:**
> * Square-1
> * Void Cube
**In queue:**
> * 2-3-4 Relay
> * FMC
> * Megaminx
> * 3x3 Relay of 3
> * 3x3 Mirror blocks/Bump
> * F2l
> * 6x6x6
> * 4x4 OH
> * 7x7x7
> * 3x3x4
> * 3x3x5
**Weekly Events:**
> * 2x2
> * 3x3
> * 4x4
> * 3x3OH
> * 2GEN
> * LSE
> * OLL
**Weekly Rotation:** (one of these events will be used)
> * 5x5
> * Skewb
> * Pyraminx
> * BLD
**This Week's Bonus Event:**
> * Square-1
**In queue:**
> * Void Cube
> * 2-3-4 Relay
> * FMC
> * Megaminx
> * 3x3 Relay of 3
> * 3x3 Mirror blocks/Bump
> * F2l
> * 6x6x6
> * 7x7x7
> * 4x4 OH
> * 3x3x4
> * 3x3x5
Anyway, good luck to all those competing, especially those with upcoming WCA competitions!
**2x2:**
> 1. <span class="scramble_to_fill" data-cube-size="222"></span>
> 1. <span class="scramble_to_fill" data-cube-size="222"></span>
> 1. <span class="scramble_to_fill" data-cube-size="222"></span>
> 1. <span class="scramble_to_fill" data-cube-size="222"></span>
> 1. <span class="scramble_to_fill" data-cube-size="222"></span>
**3x3:**
> 1. <span class="scramble_to_fill" data-cube-size="333"></span>
> 1. <span class="scramble_to_fill" data-cube-size="333"></span>
> 1. <span class="scramble_to_fill" data-cube-size="333"></span>
> 1. <span class="scramble_to_fill" data-cube-size="333"></span>
> 1. <span class="scramble_to_fill" data-cube-size="333"></span>
**4X4:**
> 1. <span class="scramble_to_fill" data-cube-size="444"></span>
> 1. <span class="scramble_to_fill" data-cube-size="444"></span>
> 1. <span class="scramble_to_fill" data-cube-size="444"></span>
> 1. <span class="scramble_to_fill" data-cube-size="444"></span>
> 1. <span class="scramble_to_fill" data-cube-size="444"></span>
**3x3OH:** (in this mode of solving, you can only solve with one hand)
> 1. <span class="scramble_to_fill" data-cube-size="333oh"></span>
> 1. <span class="scramble_to_fill" data-cube-size="333oh"></span>
> 1. <span class="scramble_to_fill" data-cube-size="333oh"></span>
> 1. <span class="scramble_to_fill" data-cube-size="333oh"></span>
> 1. <span class="scramble_to_fill" data-cube-size="333oh"></span>
**todo_rotation_event**
> 1.
> 1.
> 1.
> 1.
> 1.
**todo_requested_event**
> 1.
> 1.
> 1.
> 1.
> 1.
**todo_requested_event**
> 1.
> 1.
> 1.
> 1.
> 1.
**2GEN:**(in this mode of solving, you can only do <R,U>, which has the moves R, R', R2, U, U', U2)
> 1.
> 1.
> 1.
> 1.
> 1.
**LSE:**(in this mode of solving, you can only do <M,U>, which has the moves M, M', M2, U, U', U2)
> 1.
> 1.
> 1.
> 1.
> 1.
**OLL:** This week, we're doing [OLL <span class="compoll">todo_oll_num</span>] (http://algdb.net/Set/OLL/OLL%20<span class="compoll">todo_oll_number</span>)!
</pre>
<script src="//code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.min.js"></script>
<script src="sweetalert/sweetalert.min.js"></script>
<script src="scramblers/scramble_222.js" charset="utf-8"></script>
<script src="scramblers/scramble_333.js" charset="utf-8"></script>
<script src="scramblers/scramble_NNN.js" charset="utf-8"></script>
<script src="scramblers/scramble_sq1.js" charset="utf-8"></script>
<script>
var this_comp_num, this_oll_num, this_comp_deadline, this_comp_deadline_date;
var update_markup, change_comp_linear;
// global function to update markup as per the global variables
update_markup = function () {
var main_dict = {
'compnum': this_comp_num,
'compoll': this_oll_num,
'compdeadline': this_comp_deadline_date.toUTCString()
};
for (var key in main_dict) {
var value = main_dict[key];
$('.main-form input[name=' + key + ']').each(function () {
$(this).val(value);
});
$('span.' + key).each(function () {
$(this).html(value);
});
}
};
// global function to increment or decrement the competition number
// and other variables.
change_comp_linear = function (offset) {
this_oll_num += offset;
this_comp_num += offset;
this_comp_deadline_date = new Date(this_comp_deadline_date.getTime() +
offset * milliseconds_per_week);
update_markup();
}
// REFERENCES
// Reference competition number, deadline and OLL number
// Comp 158 ended on this date
var ref_comp = 158;
var ref_comp_deadline = 'Mon, 23 Nov 2015 02:00:00 GMT';
var ref_oll_number = 22;
var ref_date = new Date(ref_comp_deadline);
// CONSTANTS
var milliseconds_per_week = 1000 * 3600 * 24 * 7;
$(document).ready(function () {
// calculate the appropriate comp number and the comp deadline
var num_weeks_float = (new Date() - ref_date) / milliseconds_per_week;
this_comp_num = Math.ceil(num_weeks_float) + ref_comp;
this_oll_num = Math.ceil(num_weeks_float) + ref_oll_number;
this_comp_deadline = ref_date.getTime() + milliseconds_per_week * Math.ceil(num_weeks_float);
this_comp_deadline_date = new Date(this_comp_deadline);
console.log('Competition number calculated to be: ' + this_comp_num);
console.log('Competition deadline calculated to be: ' + this_comp_deadline_date);
console.log('OLL number for this competition: ' + this_oll_num);
update_markup();
toastr["success"]("Done! Markup has been updated with calculated values!");
// fill scrambles
$('.scramble_to_fill').each(function () {
$(this).html(scramblers[$(this).attr('data-cube-size')].getRandomScramble().scramble_string);
});
// handle the form submit
$('.main-form').on('submit', function (e) {
console.log('Form submitted.');
$('.main-form input').each(function () {
console.log('span.' + $(this).attr('name'));
if ($(this).attr('name')) {
$('span.' + $(this).attr('name')).html($(this).val());
}
});
e.preventDefault();
toastr["success"]("Done! Markup has been updated!");
});
// hide the form when the hide form button is pressed
$('input.hide-form').on('click', function () {
$('.main-form-container').hide();
});
// handle the next comp and previous competition buttons
$('input.edit-comp-button').on('click', function () {
change_comp_linear(parseInt($(this).attr('data-increment'), 10));
toastr["success"]("Done! Markup has been updated with required increment!");
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment