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
var revertDom = function(num){ | |
var __callback = function(creds){ | |
var uname = creds.username; | |
var pw = creds.password; | |
var authString = "Basic " + btoa(uname + ":" + pw); | |
var req = { | |
url: "/revert/" + num, | |
method: "get", | |
headers: { |
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
var btnResetHandler = function(evt){ | |
var credPromise = getCreds(); | |
var downloadPromise = credPromise.then(downloadDomSet); | |
downloadPromise.then(updateAllFieldsCallback); | |
}; |
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
var loadHandler = function(){ | |
var promise = getUserCredentials(); | |
promise.then(loadUserData); | |
}; |
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
// delegate event handling example. | |
$(".table").on("click", ".saveButton", saveButtonHandler); | |
var saveButtonHandler = function(evt){ | |
var btn = this; | |
id = btn.getAttribute("id"); | |
// do whatever else that needs be done with respect | |
// this particular button..... | |
}; |
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
from flask import request, abort | |
import model | |
@app.route("/save", methods=["POST"]) | |
def save_image(): | |
auth_data = request.authorization | |
user_name = auth_data.username | |
password = auth_data.password | |
if not model.is_password_valid(user_name, password, prehashed=True): |
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
import hashlib | |
def is_password_valid(uname, pw, prehashed=False): | |
if prehashed: | |
password_arg = pw | |
else: | |
hasher = hashlib.sha1() | |
hasher.update(pw.encode()) | |
password_arg = hasher.hexdigest() |
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
import bpy | |
class ToggleExtremeties(bpy.types.Operator): | |
""" | |
Toggle whether or not to show or hide the extremity bones. | |
(ie the bones that don't have any children.) | |
""" | |
bl_idname = "armature.toggle_extremeties" | |
bl_label = "Toggle Bone Extremeties" | |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>jQuery Loop Concat</title> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script> | |
</head> | |
<body> | |
<ul id="targetlist"> |
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
var deleteButton = makeDeleteButton(rec.id); | |
var changeButton = makeChangeButton(rec.id, rec.title, rec.detail); | |
var rowData = { | |
id: rec.id, | |
title: rec.title, | |
detail: rec.detail | |
}; | |
var rowTemplText = $("#notesRowTempl").html(); |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>Handlebars looping example</title> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.5/handlebars.min.js"></script> | |
</head> | |
<body> |