Skip to content

Instantly share code, notes, and snippets.

@bennett39
bennett39 / calculate-pi-to-nth-digit.markdown
Last active September 2, 2018 19:46
Calculate Pi to Nth Digit
@bennett39
bennett39 / index.html
Last active September 2, 2018 19:52
Reverse a string
<label for="strQuery">Enter a string:</label>
<input type="text" id="strQuery">
<button type="submit" id="submit">Submit</button>
<p id="result"></p>
@bennett39
bennett39 / epub.css
Last active January 26, 2019 00:06 — forked from bmaupin/epub.css
You Don't Know JS Ebooks
body {
text-align: justify;
}
code, pre {
font-family: "DejaVuSansMono", monospace;
}
h1, h2, h3, h4, h5, h6 {
text-align: left;
import json
import random
def lambda_handler(event, context):
""" Build a random cold-cut sandwich """
meats = [
'ham', 'salami', 'turkey', 'chicken', 'meatball', 'tempeh'
]
cheeses = [
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<script>
async function fetchSandwich() {
let apiUrl = 'https://***.execute-api.us-east-2.amazonaws.com/default/lambda_tutorial'
let response = await fetch(apiUrl);
let body = await response.json();
document.getElementById('sandwich-result').innerHTML = body.sandwich;
def analyze_audit_history(self):
""" Parse audit history response and separate out deletes vs modifications/creations """
last_modified_by_type, modified_ids, deleted_ids = {}, set(), set()
last_modified_by_type['glbatch'] = arrow.now() # Always consider glbatches modified
for audit_trail in self._get_audit_trail():
for event in audit_trail.response.data.find_all('audithistory'):
object_type = event.objecttype.get_text()
# Consolidate journal and glbatch to be the same, since they hit the same endpoint
import Vue from 'vue'
import App from './App.vue'
Vue.config.productionTip = false
new Vue({
render: h => h(App),
}).$mount('#app')
<!DOCTYPE html>
<html>
<head></head>
<body>
<h1>Testing Vue...</h1>
<div id="app"></div>
</body>
</html>
from django.shortcuts import render
def vue_test(request):
return render(request, 'myapp/vue-test.html')
from django.contrib import admin
from django.urls import path
from myapp import views as myapp_views
urlpatterns = [
path('admin/', admin.site.urls),
path('vue-test', myapp_views.vue_test),
]