Skip to content

Instantly share code, notes, and snippets.

View nickhargreaves's full-sized avatar
👨‍💻

Nick Hargreaves nickhargreaves

👨‍💻
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nickhargreaves
nickhargreaves / 1.json
Created August 13, 2013 12:15
malawi districts
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nickhargreaves
nickhargreaves / geocode.php
Last active January 22, 2018 16:10
Google Maps API Show Marker using address or coordinates
<!DOCTYPE html>
<html>
<head>
<title>Geocode with Google Maps</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
html, body, #map-canvas {
height: 100%;
margin: 0px;
@nickhargreaves
nickhargreaves / google_apps_script_copy_files_with_heirarchy_and_permissions
Last active June 10, 2023 11:53
Google Apps Script: Copy Files With Hierarchy and Permissions
function copyDriveWithPermissions(){
var originFolder = DriveApp.getFolderById("XXX-XXX");
var destinationFolder = DriveApp.getFolderById("XXX-XXX");
var currentFolder = destinationFolder;
var totalCount = traverseFolder(originFolder,0, currentFolder);
}
function traverseFolder(folder,total, currentFolder) {
@nickhargreaves
nickhargreaves / AndroidJSONParser
Created July 18, 2015 19:06
Android JSON Parser
package com.pushapp.tests;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.List;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
@nickhargreaves
nickhargreaves / mine_tweets_db.py
Created August 1, 2015 14:20
Mine tweets by keyword, date and location boundaries using Python and Tweepy and load into mysql database
import tweepy
from tweepy import Stream
from tweepy import OAuthHandler
from tweepy.streaming import StreamListener
import json
import datetime
import MySQLdb;
consumer_key = ''
consumer_secret = ''
<?php
$link = mysql_connect('localhost', '', '');
mysql_select_db('');
$create_table = "CREATE TABLE IF NOT EXISTS `json` (
`id` int(11) NOT NULL,
`reporting-org_type` text NOT NULL,
`reporting-org_ref` text NOT NULL,
`reporting-org_text` text NOT NULL,
`iati-identifier` text NOT NULL,
{"checklists":[{"id":"1","name":"Category 1","items":[{"id":"1","text":"question1"},{"id":"2","text":"question2"},{"id":"3","text":"question3"}]},{"id":"2","name":"Category 2","items":[{"id":"4","text":"question4"},{"id":"5","text":"question5"}]}]}
@nickhargreaves
nickhargreaves / geocode_db_list.php
Last active January 27, 2016 10:30
Scrapper for geocoding list with multiple location columns
<?php
/**
* Scrapper for geocoding list with multiple location columns
* If a finer location fails, it settles for the next best thing
*
* @author http://twitter.com/nickhargreaves
*/
//Db connection
$link = mysql_connect("", "", "");
import base64
import datetime
import json
from django.conf import settings
import requests
import uuid
def make_request(url, data, request_date, msisdn, pin):