This file contains hidden or 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
def launch_gateway(): | |
if "PYSPARK_GATEWAY_PORT" in os.environ: | |
gateway_port = int(os.environ["PYSPARK_GATEWAY_PORT"]) | |
else: | |
SPARK_HOME = os.environ["SPARK_HOME"] | |
# Launch the Py4j gateway using Spark's run command so that we pick up the | |
# proper classpath and settings from spark-env.sh | |
on_windows = platform.system() == "Windows" | |
script = "./bin/spark-submit.cmd" if on_windows else "./bin/spark-submit" | |
submit_args = os.environ.get("PYSPARK_SUBMIT_ARGS", "pyspark-shell") |
This file contains hidden or 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{ | |
var config = require('./config') | |
} catch(err){ | |
var config = createConfig() | |
} | |
module.exports = config |
This file contains hidden or 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
let a = 0 | |
if(true){ | |
let a = 1 | |
console.log(a) | |
} |
This file contains hidden or 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
const formToObj = ({ elements }) => elements.reduce((prev, { name, value }) => prev[name] = value, {}) | |
var myForm = document.querySelector('form') | |
myForm.addEventListener('submit', function (e) { | |
e.preventDefault() | |
fetch('/', { | |
method: 'post', | |
headers: { | |
'Accept': 'application/json', | |
'Content-Type': 'application/json' |
This file contains hidden or 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
const crimeArray = neighborhood.properties.crime2 | |
console.log(crimeArray[crimeArray.length-1].violent_crime_index < crimeArray[crimeArray.length-2].violent_crime_index) | |
console.log(crimeArray[crimeArray.length-1].violent_crime_trend === 0) |
This file contains hidden or 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 bash | |
# names of latest versions of each package | |
export VERSION_PCRE=pcre-8.38 | |
export VERSION_OPENSSL=openssl-1.0.2g | |
export VERSION_NGINX=nginx-1.11.0 | |
# URLs to the source directories | |
export SOURCE_OPENSSL=https://www.openssl.org/source/ | |
export SOURCE_PCRE=ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ |
This file contains hidden or 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
tar xzvf elm-format-0.17-0.4.0-alpha-mac-x64.tgz | |
cp elm-format /usr/local/bin/elm-format | |
rm elm-format | |
rm elm-format-0.17-0.4.0-alpha-mac-x64.tgz |
This file contains hidden or 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
//Groups of polygons | |
geosjon | |
.features | |
//get area of polygons | |
.map(area) | |
//get the average area of polygons | |
.reduce( | |
(average, value, size) => (size * average + value) / (size + 1), | |
0 | |
) |
This file contains hidden or 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
<html> | |
<head> | |
<title> | |
Audio | |
</title> | |
</head> | |
<body> | |
<audio id="myAudio" autoplay preload="auto" class="audio--source"> |
This file contains hidden or 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 mapValues = function mapValues(obj, map) { | |
return Object.keys(obj).reduce(function (o, k) { | |
return Object.assign(o, _defineProperty({}, k, map(obj[k]))); | |
}, {}); | |
} |
OlderNewer