This file contains 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
//Add center result control button | |
L.easyButton({ | |
states: [{ | |
stateName: 'zoom-to-forest', | |
icon: 'glyphicon glyphicon-screenshot', | |
title: 'Center map to heat results', | |
onClick: function(btn, map) { | |
if (typeof $scope.heatLayer != 'undefined' | |
&& typeof $scope.maxGlobalHeat != 'undefined') { | |
map.setView($scope.maxGlobalHeat, 10); |
This file contains 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
map.zoomControl.removeFrom(map); | |
// create the control | |
var autoZoomCheckbox = L.control({position: 'topleft'}); | |
autoZoomCheckbox.onAdd = function (map) { | |
var div = L.DomUtil.create('div', 'command'); | |
div.innerHTML = '<form><input id="command" type="checkbox"/>Auto fit bounds</form>'; | |
return div; | |
}; | |
autoZoomCheckbox.addTo(map); |
This file contains 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
public enum CardViewType { | |
SUBSCRIBED(1), | |
REJECTED(2), | |
NEW(3); | |
private int value; | |
private static Map<Integer, CardViewType> map = new HashMap<>(); | |
CardViewType(int value) { | |
this.value = value; |
This file contains 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
DecimalFormat df = new DecimalFormat("#.####"); | |
df.setRoundingMode(RoundingMode.CEILING); | |
double newLat = Double.valueOf(df.format(coordinates.latitude)); | |
double newLong = Double.valueOf(df.format(coordinates.longitude)); |
This file contains 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
@Test | |
public void testGzipSource() throws IOException { | |
String original = "Some super super long string.Some super super long string." + | |
"Some super super long string." + | |
"Some super super long string." + | |
"Some super super long string." + | |
"Some super super long string." + | |
"Some super super long string." + | |
"Some super super long string." + | |
"Some super super long string."; |
This file contains 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
//Done in a MapFragment | |
@Override | |
public void onMapReady(GoogleMap googleMap) { | |
mMap = googleMap; | |
UiSettings mapUiSettings = mMap.getUiSettings(); | |
mapUiSettings.setCompassEnabled(false); | |
mapUiSettings.setZoomControlsEnabled(false); | |
mapUiSettings.setMapToolbarEnabled(false); | |
} |
This file contains 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
*ptr = '\n'; | |
ptr++; | |
*ptr = '\n'; | |
ptr++; | |
base = (PacketHdrBase*)ptr; |
This file contains 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 serial | |
import time | |
def main(): | |
ser = serial.Serial('/dev/ttyUSB0', 230400, timeout=1) | |
print(ser.name) | |
count = 0 | |
while True: |
This file contains 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
#!/bin/bash | |
DEVICE=/dev/ttyUSB0 | |
BAUDRATE=230400 | |
echo "=======SETTINGS=========" | |
echo "port: $DEVICE" | |
echo "spped: $BAUDRATE" | |
echo "========================" |
This file contains 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
class SimpleProjectModelChoicesField(ModelChoiceField): | |
def label_from_instance(self, obj): | |
return '{name}'.format(name=obj.name) | |
class CourseForm(ModelForm): | |
project = SimpleProjectModelChoicesField(queryset=Project.objects.filter(is_active=True)) | |
def __init__(self, *args, **kwargs): | |
self.request = kwargs.pop("request") |