https://developer.foursquare.com/docs/users/checkins.html
 https://developer.foursquare.com/docs/explore.html#req=users/self/checkins
490201
def checkins(options={})
      @foursquare.get("users/#{id}/checkins", options)["checkins"]["items"].map do |item|
        Foursquare::Checkin.new(@foursquare, item)
      end
    end
1190767
function check() {
        if (done) {
          return;
        }
        checks--;
        if (checks <= 0) {
          return;
        }
        if (checks === 0) {
          done = true;
          finish(new Error('Machine unresponsive to STOP'));
          return;
        }
        var checkOptions = {
          method: 'GET',
          path: self.account + '/machines/' + serverId
        };

        self._request(checkOptions, function (err, body) {
          if (err) { return callback && callback(err) }
          if (body && body.state === 'stopped') {
            done = true;
            finish();
            return;
          }
        });

        setTimeout(check, 5000);
      }
1152043
public function getCheckins(array $options = array())
    {

        $uri = $this->buildUserResourceUri('checkins');
        $response = $this->makeAuthenticatedApiRequest($uri, $options);

        return $response->checkins->items;

    }
1170243
private function checkLiveMode() {
		if(config('dokularavel.LIVE_MODE') == TRUE) {
			$this->prePaymentUrl      = 'https://pay.doku.com/api/payment/PrePayment';
			$this->paymentUrl         = 'https://pay.doku.com/api/payment/paymentMip';
			$this->directPaymentUrl   = 'https://pay.doku.com/api/payment/PaymentMIPDirect';
			$this->generateCodeUrl    = 'https://pay.doku.com/api/payment/doGeneratePaymentCode';
			$this->redirectPaymentUrl = 'https://pay.doku.com/api/payment/doInitiatePayment';
			$this->captureUrl         = 'https://pay.doku.com/api/payment/DoCapture';
			$this->paymentStatusUrl   = 'https://pay.doku.com/Suite/CheckStatus';
		}
	}
731258
def check_in_periodically
      @check_in_thread = Thread.new do
        loop do
          check_on_workers
          reply = ""
          1.upto(5).each do | attempt_number |
            # sleep for an ever increasing amount of time to prevent overloading the server
            sleep CHECK_IN_INTERVAL * attempt_number
            reply = check_in
            # if we did not receive a reply, the server has went away; it
            # will reply with an empty string if the check-in succeeds
            if reply.nil?
              CloudCrowd.log "Failed on attempt ##{attempt_number} to check in with server"
            else
              break
            end
          end
          if reply.nil?
            CloudCrowd.log "Giving up after repeated attempts to contact server"
            raise SystemExit
          end
        end
      end
    end
482322
@Override
    public void checkin(K key, V resource) {
        super.checkin(key, resource);
        // NB: Blocking checkout calls for synchronous requests get the resource
        // checked in above before processQueueLoop() attempts checkout below.
        // There is therefore a risk that asynchronous requests will be starved.
        processQueueLoop(key);
    }
476757
function getSurveys (defOptions, credentials, token, surveyId, callback) {
  var options;
  
  surveyId = surveyId || '';
  
  if (typeof surveyId === 'function') {
    callback = surveyId;
    surveyId = '';
  }
  
  options = {
    method : 'GET',
    uri : `v1/Surveys/${surveyId}`,
  };
  
  return requestWithTokenCheck(defOptions, credentials, token, options, callback);
}
469558
function checkUser( &$siteBasics, $uri )
    {
        $http = eZHTTPTool::instance();
        $check = array( "module" => "user",
                        "function" => "login" );
        if ( eZSession::issetkey( 'eZUserLoggedInID', false ) &&
             $http->sessionVariable( "eZUserLoggedInID" ) != '' &&
             $http->sessionVariable( "eZUserLoggedInID" ) != self::anonymousId() )
        {
            $currentUser = eZUser::currentUser();
            if ( !$currentUser->isEnabled() )
            {
                eZUser::logoutCurrent();
                $currentUser = eZUser::currentUser();
            }
            else
            {
                return null;
            }
        }

        $ini        = eZINI::instance();
        $moduleName = $uri->element();
        $viewName   = $uri->element( 1 );
        $anonymousAccessList = $ini->variable( "SiteAccessSettings", "AnonymousAccessList" );
        foreach ( $anonymousAccessList as $anonymousAccess )
        {
            $elements = explode( '/', $anonymousAccess );
            if ( !isset( $elements[1] ) )
            {
                if ( $moduleName == $elements[0] )
                {
                    return null;
                }
            }
            else
            {
                if ( $moduleName == $elements[0] and
                     $viewName == $elements[1] )
                {
                    return null;
                }
            }
        }

        return $check;
    }
974851
def infer_location(
            self,
            location_query,
            max_distance,
            google_key,
            foursquare_client_id,
            foursquare_client_secret,
            limit
        ):
        

        self.location_from = infer_location(
            self.points[0],
            location_query,
            max_distance,
            google_key,
            foursquare_client_id,
            foursquare_client_secret,
            limit
        )
        self.location_to = infer_location(
            self.points[-1],
            location_query,
            max_distance,
            google_key,
            foursquare_client_id,
            foursquare_client_secret,
            limit
        )

        return self
970470
def _get(url, headers={}, params=None):
    """"""
    param_string = _foursquare_urlencode(params)
    for i in xrange(NUM_REQUEST_RETRIES):
        try:
            try:
                response = requests.get(url, headers=headers, params=param_string, verify=VERIFY_SSL)
                return _process_response(response)
            except requests.exceptions.RequestException as e:
                _log_and_raise_exception('Error connecting with foursquare API', e)
        except FoursquareException as e:
            # Some errors don't bear repeating
            if e.__class__ in [InvalidAuth, ParamError, EndpointError, NotAuthorized, Deprecated]: raise
            # If we've reached our last try, re-raise
            if ((i + 1) == NUM_REQUEST_RETRIES): raise
        time.sleep(1)
354265
public function checkin($venueId, $shout, array $options = array())
    {
        $resource = '/checkins/add';

        $response = $this->makeApiRequest($resource, compact('venueId','shout') + $options, 'POST');

        return $response;
    }
738567
function doSearch() {
    var value = document.getElementById('search').value;
    marks = [];
    marksIndex = 0;
    for (var key in markers) {
        if ( (~(key.toLowerCase()).indexOf(value.toLowerCase())) && (mb.contains(markers[key].getLatLng()))) {
            marks.push(markers[key]);
        }
        if (markers[key].icon === value) {
            marks.push(markers[key]);
        }
    }
    moveToMarks();
    if (marks.length === 0) {
        // If no markers found let's try a geolookup...
        var protocol = location.protocol;
        if (protocol == "file:") { protocol = "https:"; }
        var searchUrl = protocol + "//nominatim.openstreetmap.org/search?format=json&limit=1&q=";

        fetch(searchUrl + value) // Call the fetch function passing the url of the API as a parameter
        .then(function(resp) { return resp.json(); })
        .then(function(data) {
            if (data.length > 0) {
                var bb = data[0].boundingbox;
                map.fitBounds([ [bb[0],bb[2]], [bb[1],bb[3]] ]);
                map.panTo([data[0].lat, data[0].lon]);
            }
            else {
                document.getElementById('searchResult').innerHTML = "&nbsp;<font color='#ff0'>Not Found</font>";
            }
        })
        .catch(function(err) {
            if (err.toString() === "TypeError: Failed to fetch") {
                document.getElementById('searchResult').innerHTML = "&nbsp;<font color='#ff0'>Not Found</font>";
            }
        });
    }
    else {
        if (lockit) {
            document.getElementById('searchResult').innerHTML = "&nbsp;<font color='#ff0'>Found "+marks.length+" results within bounds.</font>";
        } else {
            document.getElementById('searchResult').innerHTML = "&nbsp;<font color='#ff0'>Found "+marks.length+" results.</font>";
        }
    }
}
370977
def post_check_request(self, check, subscribers):
        
        data = {
            'check': check,
            'subscribers': [subscribers]
        }
        self._request('POST', '/request', data=json.dumps(data))
        return True
135902
function (parameters, callback) {
        callback(util.format('Sorry, there are no %s rooms available at %s for your chosen dates (%s) to (%s), please try another search.',
            parameters.RoomType || '', parameters.Place, formatDate(parameters.Checkin), formatDate(parameters.Checkout)));
    }
495361
def getGuestList(request):
    '''
    
    '''
    if not (
        request.method == 'POST' and
        request.POST.get('guestlist_id') and
        request.POST.get('event_id') and
        request.user.is_authenticated and
        request.user.has_perm('guestlist.view_guestlist')
    ):
        return JsonResponse({})

    guestList = GuestList.objects.filter(id=request.POST.get('guestlist_id')).first()
    event = Event.objects.filter(id=request.POST.get('event_id')).first()

    if not guestList or not event:
        return JsonResponse({})

    return JsonResponse({
        'names': guestList.getListForEvent(event),
    })
637414
function getVisUrl(url) {
    var match = /https?:\/\/(\S+)\.cartodb\.com\/viz\/(\S+)\/(?:public_)?map/.exec(url);
    if (match) {
        var user = match[1],
            mapId = match[2];
        return 'https://' + user + '.cartodb.com/api/v2/viz/' + mapId + '/viz.json';
    }
}
504960
function doCheckout() {
	var res;

	group("Checkout 1: review cart", function() {
		// Checkout step 1: Review cart
		res = http.get(baseURL + "/cart");
		check(res, {
			"title is correct": (res) => res.html("title").text() === 'Shopping cart | David li commerce-test'
		});
	});

	// Did we add any products to our cart?  If not, skip the rest of the checkout process
	if (res.body.includes("Your shopping cart is empty.")) {
		return;
	}

	group("Checkout 2: submit cart", function() {
		let formID = res.body.match('name="form_id" value="(.*)"')[1];
		let formToken = res.body.match('name="form_token" value="(.*)"')[1];
		let formBuildID = res.body.match('name="form_build_id" value="(.*)"')[1];
		let formdata = {
			"form_build_id": formBuildID,
			"form_token": formToken,
			"form_id": formID,
			"op": "Checkout"
		};
		let headers = { "Content-Type": "application/x-www-form-urlencoded" };
		res = http.post(baseURL + "/cart", formdata, { headers: headers });
		check(res, {
			"cart submit succeeded": (res) => res.url.includes("/checkout/")
		}) || fail("cart submit failed");
	});

	// The previous POST operation should get redirected to a dynamic URL that has a
	// path that looks like e.g. "/checkout/7". Later checkout steps get redirected
	// to paths that are prefixed with this dynamic string, which means we need to
	// save it in order to be able to (easily) verify that later POSTs are successful
	// and get redirected to e.g. "/checkout/7/shipping"
	let checkoutBaseURL = res.url;

	group("Checkout 3: billing details", function() {
		let formID = res.body.match('name="form_id" value="(.*)"')[1];
		let formToken = res.body.match('name="form_token" value="(.*)"')[1];
		let formBuildID = res.body.match('name="form_build_id" value="(.*)"')[1];
		// try without setting Referer
		let formdata = {
			"customer_profile_billing[commerce_customer_address][und][0][country]": "SE",
			"customer_profile_billing[commerce_customer_address][und][0][name_line]": "Mr Test",
			"customer_profile_billing[commerce_customer_address][und][0][thoroughfare]": "Gotgatan 14",
			"customer_profile_billing[commerce_customer_address][und][0][premise]": "",
			"customer_profile_billing[commerce_customer_address][und][0][postal_code]": "11846",
			"customer_profile_billing[commerce_customer_address][und][0][locality]": "Stockholm",
			"customer_profile_shipping[commerce_customer_profile_copy]": "1",
			"form_build_id": formBuildID,
			"form_token": formToken,
			"form_id": formID,
			"op": "Continue to next step"
		};
		let headers = { "Content-Type": "application/x-www-form-urlencoded" };
		res = http.post(checkoutBaseURL, formdata, { headers: headers });
		check(res, {
			"billing details succeeded": (res) => res.url === (checkoutBaseURL + "/shipping")
		}) || fail("billing details failed"); 
	});

	group("Checkout 4: shipping options", function() {
		let formID = res.body.match('name="form_id" value="(.*)"')[1];
		let formToken = res.body.match('name="form_token" value="(.*)"')[1];
		let formBuildID = res.body.match('name="form_build_id" value="(.*)"')[1];
		let formdata = {
			"commerce_shipping[shipping_service]": "express_shipping",
			"form_build_id": formBuildID,
			"form_token": formToken,
			"form_id": formID,
			"op": "Continue to next step"
		};
		let headers = { "Content-Type": "application/x-www-form-urlencoded" };
		res = http.post(checkoutBaseURL + "/shipping", formdata, { headers: headers });
		check(res, {
			"shipping options succeeded": (res) => res.url === (checkoutBaseURL + "/review")
		}) || console.log("Select shipping failed!");
	});
	
	group("Checkout 5: review and submit", function() {
		let formID = res.body.match('name="form_id" value="(.*)"')[1];
		let formToken = res.body.match('name="form_token" value="(.*)"')[1];
		let formBuildID = res.body.match('name="form_build_id" value="(.*)"')[1];
		let formdata = {
			"commerce_payment[payment_method]": "commerce_payment_example|commerce_payment_commerce_payment_example",
			"commerce_payment[payment_details][credit_card][number]": "4111111111111111",
			"commerce_payment[payment_details][credit_card][exp_month]": "03",
			"commerce_payment[payment_details][credit_card][exp_year]": "2019",
			"form_build_id": formBuildID,
			"form_token": formToken,
			"form_id": formID,
			"op": "Continue to next step"
		};
		let headers = { "Content-Type": "application/x-www-form-urlencoded" };
		res = http.post(checkoutBaseURL + "/review", formdata, { headers: headers });
		// if this POST succeeds, it will redirect to e.g. /checkout/7/payment
		// /checkout/7/payment, in turn, will redirect to /checkout/7/paypal_ec
		// /checkout/7/paypal_ec, in turn, will redirect to /checkout/7/complete
		check(res, {
			"Checkout 6: checkout complete": (res) => res.html("h1").text() === "Checkout complete"
		}) || fail("review and submit failed");
	});
}