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
if (currentRange > stopRange) { | |
forward(); | |
currentRoutine = 'd'; | |
actionDelay = 50; | |
}else { | |
if (currentRoutine != 'e') { | |
engine_stop(); | |
delay(400); | |
back(); |
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
/** | |
* localStorage with expire wrapper | |
*/ | |
var myStorage = (function() { | |
var self = {}; | |
/** | |
* Method unsets value in localStorage | |
*/ | |
self.unset = function(key) { |
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
self.getCurrent = function(onSuccess, onFailure) { | |
var cache = myStorage.get('current-json'); | |
if (cache === null) { | |
$.ajax({ | |
url : "http://api.openweathermap.org/data/2.5/weather?id=3083829&mode=json&units=metric", | |
dataType : 'jsonp', | |
success : function(json) { |
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
function myFunction(foo) { | |
bar = 'foo'; | |
console.log(bar); | |
console.log(foo); | |
} | |
var bar = 'bar', | |
baz = 'baz'; | |
console.log(bar); |
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/sh | |
tries=0 | |
while [[ $tries -lt 5 ]] | |
do | |
if /bin/ping -c 1 8.8.8.8 >/dev/null | |
then | |
exit 0 | |
fi | |
tries=$((tries+1)) |
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
package pl.spychalski.WeatherStation; | |
import android.app.Application; | |
import com.google.android.gms.analytics.GoogleAnalytics; | |
import com.google.android.gms.analytics.Tracker; | |
public class PogodaApplication extends Application { | |
private Tracker appTracker = null; |
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
<application | |
android:logo="@drawable/ab_icon" | |
android:label="@string/app_name" | |
android:name=".PogodaApplication" | |
android:icon="@drawable/ic_launcher"> |
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
@Override | |
public void onResume() { | |
super.onResume(); | |
Tracker t = ((PogodaApplication) getApplication()).getTracker(); | |
t.setScreenName("ForecastActivity"); | |
t.send(new HitBuilders.AppViewBuilder().build()); | |
} |
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 RPi.GPIO as GPIO | |
import time | |
def main(): | |
# GPIO.setwarnings(False) | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setup(18, GPIO.OUT) | |
GPIO.output(18, GPIO.HIGH) | |
time.sleep(5); |
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
void enterSleep(void) { | |
set_sleep_mode(SLEEP_MODE_PWR_DOWN); | |
sleep_enable(); | |
sleep_mode(); | |
sleep_disable(); | |
} |
OlderNewer