Skip to content

Instantly share code, notes, and snippets.

#!/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))
function myFunction(foo) {
bar = 'foo';
console.log(bar);
console.log(foo);
}
var bar = 'bar',
baz = 'baz';
console.log(bar);
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) {
@DzikuVx
DzikuVx / gist:5693478
Last active December 17, 2015 23:59
JavaScript Local Storage with item expire
/**
* localStorage with expire wrapper
*/
var myStorage = (function() {
var self = {};
/**
* Method unsets value in localStorage
*/
self.unset = function(key) {
if (currentRange > stopRange) {
forward();
currentRoutine = 'd';
actionDelay = 50;
}else {
if (currentRoutine != 'e') {
engine_stop();
delay(400);
back();