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
// Go to | |
// https://txdps.maps.arcgis.com/apps/opsdashboard/index.html#/dce4d7da662945178ad5fbf3981fa35c | |
// Then copy and paste the code below into the console | |
// Step 1: Load SaveAs Function from File-Saver | |
function b(a,b){return "undefined"==typeof b?b={autoBom:!1}:"object"!=typeof b&&(console.warn("Deprecated: Expected third argument to be a object"),b={autoBom:!b}),b.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\uFEFF",a],{type:a.type}):a}function c(b,c,d){var e=new XMLHttpRequest;e.open("GET",b),e.responseType="blob",e.onload=function(){a(e.response,c,d)},e.onerror=function(){console.error("could not download file")},e.send()}function d(a){var b=new XMLHttpRequest;return b.open("HEAD",a,!1),b.send(),200<=b.status&&299>=b.status}function e(a){try{a.dispatchEvent(new MouseEvent("click"))}catch(c){var b=document.createEvent("MouseEvents");b.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),a.dispatchEvent(b)}}var f="object |
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
javascript:(function(){ | |
s = ".p-workspace__primary_view"; | |
function x(attr, val){document.querySelector(s).style[attr]=val;} | |
x('position', 'fixed'); | |
x('background-color', 'white'); | |
x('top', 0); | |
x('right', 0); | |
x('left', 0); | |
x('bottom', 0); | |
})(); |
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
/** | |
* Simple Node Script for Downloading Google Drive files (Drive API v3). | |
* Use these instructions to get a GAPI_CLIENT_EMAIL and GAPI_PRIVATE_KEY: https://github.com/The-Politico/api-to-sheets#making-a-google-service-account | |
* See all available types by document here: https://developers.google.com/drive/api/v3/manage-downloads | |
*/ | |
const { JWT } = require('google-auth-library'); | |
const { google } = require('googleapis'); | |
const client = new JWT({ |
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
/** | |
* Available Exports: | |
* @export {array} postalFipsList – list of state objects with 'FIPS' and 'postal' keys | |
* @export {object} fipsByPostal – dictionary with postal codes as keys and corresponding FIPS code as value | |
* @export {object} postalByFips – dictionary with FIPS codes as keys and corresponding postal code as value | |
* @export {function} fips2Postal – function to convert a fips code to a postal code. | |
* @export {function} postal2Fips – function to convert a postal code to a fips code. | |
*/ | |
const fipsByPostal = { |
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
# Source: https://wiki.python.org/moin/SortingListsOfDictionaries | |
def sortDictList(arr, sort_key): | |
output = [(dict_[sort_key], dict_) for dict_ in arr] | |
output.sort() | |
return [dict_ for (key, dict_) in output] |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from flask import Flask, request | |
from urllib import unquote_plus | |
import json | |
import re | |
app = Flask(__name__) |
When writing django apps it's easy to ignore the organization of your front end code. Often, these backend coders will just write a static js
and css
file, stick it in the static directory, and call it a day.
You can also build them as two completely independent parts. With a complex gulp build routine independent of the django app. But if you don't know gulp, node, or those kinds of systems it can be a daunting process to get started with.
Enter django-compressor-toolkit (the name doesn't quite roll off the tongue).
Using django-compressor and django-compressor-toolkit you can write Javascript ES6 code with all its fancy import/export
logic or style your pages with sass
instead of css
, and leave your deploy routine largely untouched.
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
function get(url){ | |
var dataString = 'url='+url; | |
$.ajax({ | |
url: "get.php", | |
type: "POST", | |
data: dataString, | |
success: function(html) { | |
// Stuff... | |
// HTML = the page | |
}, |
NewerOlder