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
''' | |
This program controls the state of the waterpump and | |
LED's of the nuclear power station. | |
If the pump stops working a countdown of 10 seconds starts | |
ticking and then does 2 things: | |
1) turning on red lights instead of blue lights in the | |
reactor's core. | |
2) cutting the power: writing outpin HIGH (on the arduino | |
of the power system this will set the power out. |
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
import Tkinter as tk | |
import serial | |
ANGLE_MIN = 0 | |
ANGLE_MAX = 180 | |
SERVO_MIN = 1 | |
SERVO_MAX = 4 | |
# Assign Arduino's serial port address | |
# Windows example |
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
$(document).ready(function() { | |
$("#submit_button").on("click", function() { | |
window.history.replaceState({}, 'foo page', '/foo'); | |
}); | |
}); |
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
import java.util.Map; | |
import processing.video.Movie; | |
String MOVIE_FILE = "videofile"; | |
String OUTPUT_DIR = "pos/"; | |
int SEEK_INTERVAL = 4; | |
String OBJ_NAME = "object_name"; | |
DisposeHandler dh; |
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
def validate_attr(instance, attr, valid, errors=None, positive=True): | |
'''Returns a list of errors (strings) for mom objects attribute | |
validation. | |
Parameters: | |
instance: instance or list of instances to validate. | |
attr: attribute name or list of attributes names as strings. | |
valid: valid value or list of valid values (invalid values if | |
positive=False). | |
errors: an optional list to aggregate the errors into. |
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
def clean_text(self): | |
data = self.cleaned_data['text'] | |
if data in [item.text for item in self.instance.list.item_set.all()]: | |
raise forms.ValidationError(DUPLICATE_ITEM_ERROR) | |
return data |