Skip to content

Instantly share code, notes, and snippets.

View enricopolanski's full-sized avatar

Enrico Polanski enricopolanski

View GitHub Profile
while True:
try:
height = int(input("Enter a number between 0 and 23: "))
except (ValueError):
print("Not an integer!")
continue
else:
if not 0 <= height <= 23:
print("Height's smaller than 0 or bigger than 23")
continue
def addCoin():
coinlist = []
while True:
coinlist.append(input("\nPlease select a coin you want to track:\n").upper())
print("\nThe list of coins you're currently tracking is: \n" + "\n".join(coinlist) + "\n")
yesorno = input("Do you want to add another one? (Y/N): ").upper()
@enricopolanski
enricopolanski / remove.py
Created September 7, 2017 17:00 — forked from anonymous/remove.py
trying to remove an item from a list.
def removeCoin():
coinlist = ["a", "b", "c", "d"]
while True:
print("\nThe list of coins you're currently tracking is: \n" + "\n".join(coinlist) + "\n")
yes_or_no = input("Do you want to remove a coin from the list? (Y/N):").upper()
if yes_or_no == "Y":
try:
coinlist.remove(input("Which coin do you want to remove?").upper())
print("\nThe list of coins you're currently tracking is: \n" + "\n".join(coinlist) + "\n")
var mammoth = require("mammoth");
mammoth.convertToHtml({path: "path/to/document.docx"})
.then(function(result){
var html = result.value; // The generated HTML
var messages = result.messages; // Any messages, such as warnings during conversion
})
.done();
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="rId3" Target="settings.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings"/>
<Relationship Id="rId7" Target="theme/theme1.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"/>
<Relationship Id="rId2" Target="styles.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"/>
<Relationship Id="rId1" Target="numbering.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering"/>
var parseFile = require("./jsxmlparser.js");
// ReferenceError: mypath is not defined
// at Object.<anonymous> (C:\Users\Aquazi\Desktop\Traducee\jsxmlparser.js:4:17)
//
// at Module._compile (module.js:624:30)
// at Object.Module._extensions..js (module.js:635:10)
// at Module.load (module.js:545:32)
// at tryModuleLoad (module.js:508:12)
// at Function.Module._load (module.js:500:3)
var fs = require("fs");
var path = require("path");
var cheerio = require("cheerio");
module.exports = (mypath) => {
var inputFile = fs.readFileSync(mypath, "utf8");
var $ = cheerio.load(inputFile, {xmlMode:true});
// defines the selector
> $("w\\:body").children().eq(2)
initialize {
'0':
{ type: 'tag',
name: 'w:p',
attribs:
{ 'w:rsidRPr': '008D7D78',
'w:rsidR': '00AA2A68',
'w:rsidP': '008D7D78',
let x function(){
console.log("i am called from inside a function")
};
let y = function(callback){
console.log("do something");
callback();
};
y(x);
let x function(){
console.log("i am called from inside a function")
};
let y = function(callback){
console.log("do something");
callback();
};
y(x);