Skip to content

Instantly share code, notes, and snippets.

View SaschaHeyer's full-sized avatar
👨‍🚀

Sascha Heyer SaschaHeyer

👨‍🚀
View GitHub Profile
@SaschaHeyer
SaschaHeyer / forOfLoops.js
Last active February 28, 2018 11:07
forOfLoops
var beers = ['Pils','Weißbier','Weizen'];
for(var beer of beers){
console.log(beer);
}
//output: Pils
//output: Weißbier
//output: Weizen
@SaschaHeyer
SaschaHeyer / templateLiterals.js
Last active February 28, 2018 12:50
templateLiterals
let beerName = 'Bitburger';
let beerPrice = 1.50;
console.log(`The ${beerName} cost ${beerPrice}`);
// output: The Bitburger cost 1.5
let beers = `Bitburger
Bolten
Heineken
`;
@SaschaHeyer
SaschaHeyer / destructuring.js
Created February 28, 2018 12:49
destructuring
const beer = {
name: 'Bitburger',
price: 1.5,
type: 'pils',
};
const { name, type } = beer;
console.log(name, type);
// output: Bitburger pils
@SaschaHeyer
SaschaHeyer / destructuring.js
Created February 28, 2018 12:52
destructuring
const beer = ['Bitburger', 1.5, 'Pils'];
const [name, price, type] = beer;
console.log(name, price, type);
// output: Bitburger 1.5 Pils
@SaschaHeyer
SaschaHeyer / destructuring.js
Created February 28, 2018 13:01
destructuring
function writeBeer({ name, type }){
console.log(name)
console.log(type)
}
let beer = {
name: 'Bitburger',
type: 'Pils'
}
@SaschaHeyer
SaschaHeyer / spead.js
Last active February 28, 2018 13:34
spead
let beers = ['Bitburger','Heineken'];
function logBeers (firstParameter, secondParameter) {
return console.log(`${firstParameter} ${secondParameter}`);
}
logBeers(...beers); // output: Bitburger Heineken
@SaschaHeyer
SaschaHeyer / syntaxDefaultParameter.js
Last active March 1, 2018 09:10
syntaxDefaultParameter
function(parameter = defaultvalue){
statements
};
// MDN syntax specification
function [name]([param1[ = defaultValue1 ][, ..., paramN[ = defaultValueN ]]]) {
statements
};
@SaschaHeyer
SaschaHeyer / authenticate.py
Last active August 29, 2019 07:15
Authenticate a Jupyter Notebook against Google Cloud Platform
# $ pip install pydata-google-auth
import pydata_google_auth
credentials = pydata_google_auth.get_user_credentials(
['https://www.googleapis.com/auth/cloud-platform'],
)
# Use the credentials in other libraries, such as the Google BigQuery
# client library.
from google.cloud import bigquery
@SaschaHeyer
SaschaHeyer / gist:093fbbaf4208deb733268b9ddfa4d5ca
Created October 30, 2019 15:05
Resize Google Kubernetes Engine Cluster
gcloud container clusters resize kubeflow --num-nodes=0 --region=us-central1-a
@SaschaHeyer
SaschaHeyer / workaround.txt
Created November 4, 2019 12:00
Jupyter Notebook is using a old or wrong Tensorflow Version
source python3/bin/activate
python -m ipykernel install --user --name=tensorflow
start jupyter notebooks
switch kernel to Tensorflow