This gist was getting a lot of comments/questions, but since there are no notifications when someone replies to a gist, I've moved the setup instructions and a bunch of sample code to a dedicated Github repo.
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
/*MODULE PATTERN*/ | |
//create a namespace | |
var shoppingCart = (function() { | |
//private variables | |
var total; | |
var basket = []; | |
//private methods |
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
// Sort array of JSON objects by date value | |
const records = [ | |
{ | |
order_id: 12345, | |
order_date: "2020-03-23" | |
}, | |
{ | |
order_id: 12346, | |
order_date: "2020-03-20" | |
}, |
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
try { | |
$client = new Google_Client(); | |
//$client->useApplicationDefaultCredentials(); | |
$client->setAuthConfig(path/to/credentials_file); | |
$client->setApplicationName([appName]); | |
$client->addScope(Google_Service_Calendar::CALENDAR); | |
$client->setAccessType("offline"); | |
$query = $this->files->get_file_by($file, "file_number"); |
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
var map; | |
var infowindow; | |
var searchwords = "agence+web"; | |
// Initiate Map | |
function initMap() { | |
var paris = {lat: 48.8704907, lng: 2.3309359}; | |
map = new google.maps.Map(document.getElementById('map'), { | |
center: paris, |
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 urllib, urllib2, simplejson | |
from django.utils.encoding import smart_str | |
def get_lat_lng(location): | |
# http://djangosnippets.org/snippets/293/ | |
# http://code.google.com/p/gmaps-samples/source/browse/trunk/geocoder/python/SimpleParser.py?r=2476 | |
# http://stackoverflow.com/questions/2846321/best-and-simple-way-to-handle-json-in-django | |
# http://djangosnippets.org/snippets/2399/ | |
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
// ******** Date Parsing ******** | |
var jsonDates = { | |
dtrx2: /\d{4}-\d{2}-\d{2}/, | |
parse: function(obj){ | |
var parsedObj = JSON.parse(obj); | |
return this.parseDates(parsedObj); | |
}, | |
parseDates: function(obj){ | |
// iterate properties | |
for(pName in obj){ |
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
<?php | |
namespace App\Providers; | |
use Illuminate\Support\ServiceProvider; | |
class GoogleDriveServiceProvider extends ServiceProvider | |
{ | |
/** | |
* Bootstrap the application services. |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> | |
<title>Items Map</title> | |
<script type="text/javascript" | |
src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"> | |
</script> |
NewerOlder