Skip to content

Instantly share code, notes, and snippets.

View hassanuos's full-sized avatar
😇
I may be slow to respond.

Hassan Raza hassanuos

😇
I may be slow to respond.
View GitHub Profile
@hassanuos
hassanuos / shoppingCart.js
Created September 7, 2022 08:29 — forked from alexhawkins/shoppingCart.js
Example of a Module Design Pattern in JavaScript
/*MODULE PATTERN*/
//create a namespace
var shoppingCart = (function() {
//private variables
var total;
var basket = [];
//private methods
@hassanuos
hassanuos / sort_array_of_JSON_objects.js
Created June 13, 2022 17:07 — forked from npearce/sort_array_of_JSON_objects.js
Sort Array of JSON Object by date values
// 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"
},
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");
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,
@hassanuos
hassanuos / helpers.py
Created January 12, 2022 13:57 — forked from mhulse/helpers.py
Django (1.3) Google Maps v3 Geocoder service lookup example
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/
@hassanuos
hassanuos / JsonDates.js
Created December 30, 2021 12:02 — forked from mdeangelo272/JsonDates.js
This simple gist will parse JSON data and convert datetime string to proper date objects. It can be extended to include other date string formats.
// ******** 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){
@hassanuos
hassanuos / !NOTE.md
Created November 30, 2021 13:08 — forked from ivanvermeyen/!NOTE.md
Setup a Laravel Storage driver with Google Drive API
@hassanuos
hassanuos / GoogleDriveServiceProvider.php
Created November 30, 2021 13:08 — forked from sergomet/GoogleDriveServiceProvider.php
Setup a Laravel Storage driver with Google Drive API
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class GoogleDriveServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
@hassanuos
hassanuos / gmaps_items.html
Created November 21, 2021 11:55 — forked from vinc/gmaps_items.html
Draw markers and circles on a map using Google Maps API and jQuery
<!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>
@hassanuos
hassanuos / DeleteOverlayButton.js
Created November 20, 2021 11:53 — forked from loyalvares/DeleteOverlayButton.js
This is a custom library to add a Delete Button ( x mark) to a Google Maps v3 Circle or Polygon when drawn. This is the working JSFiddle link [ https://jsfiddle.net/foobarbazz/vn763fu7/ ] to see it in action.
/**
* author: Loy Alvares
* This utility was written to handle deletion of circles and polygons in Google Maps V3.
*
* Also thanks to Chris Veness for the distance calculation formulae from pointA to pointB
* ( Latitude/Longitude spherical geodesy formulae & scripts )
at http://www.movable-type.co.uk/scripts/latlong.html
(c) Chris Veness 2002-2010
*/