Skip to content

Instantly share code, notes, and snippets.

@johnschimmel
johnschimmel / tabCounter.js
Created July 14, 2017 19:23
count tabbing
var tabCount = 0;
function myFocusFunction() {
tabCount++;
console.log("tab #:", tabCount);
}
var x = document.getElementsByTagName('body');
x[0].addEventListener("focus", myFocusFunction, true);

User

{
  "name": "John Doe",
  "layouts": 
    { "layout-abc": { 
      "name": "Layout ABC", "active": true }
     },
 { "layout-efg": { 

Keybase proof

I hereby claim:

  • I am johnschimmel on github.
  • I am base2john (https://keybase.io/base2john) on keybase.
  • I have a public key whose fingerprint is 3C39 B6B4 9AA2 A91C 883D 2C23 9139 1BB2 3AD2 67D3

To claim this, I am signing this object:

@johnschimmel
johnschimmel / customtheme.less
Last active January 6, 2017 20:24
diyability custom css for Illdy theme
@base: #109026;
#header .top-header .header-logo:hover {
color: @base;
}
#header .top-header .header-navigation ul li.menu-item-has-children .sub-menu li a:hover {
color: @base;
}
@johnschimmel
johnschimmel / express_s3_aws-sdk-js.js
Created April 19, 2013 16:00
ExpressJS file upload to S3
exports.new_photo = function(req, res){
// Get File upload information
var filename = req.files.image.filename; // actual filename of file
var path = req.files.image.path; //will be put into a temp directory
var mimeType = req.files.image.type; // image/jpeg or actual mime type
// Create a new blog post
var photoPost = new Photo(); // create Blog object
@johnschimmel
johnschimmel / models.py
Created October 9, 2012 14:28
example model with mongoengine and wtforms
# -*- coding: utf-8 -*-
from mongoengine import *
from flask.ext.mongoengine.wtf import model_form
from datetime import datetime
class Comment(EmbeddedDocument):
name = StringField()
comment = StringField()
timestamp = DateTimeField(default=datetime.now())
@johnschimmel
johnschimmel / sample_form.html
Last active January 20, 2016 12:58
sample form with flask-mongoengine wtform validation
<form method="POST" role="form">
{{ form.csrf_token }}
<legend><h3>Share Your Ideas</h3></legend>
{% if form.errors %}
<ul class="errors">
{% for field_name, field_errors in form.errors|dictsort if field_errors %}
{% for error in field_errors %}
<li>{{ form[field_name].label }}: {{ error }}</li>
<div id="dynamicContent"></div>
<hr>
<button id="mrButton">Click me</button>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script>
jQuery('#mrButton').click(function(e){
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="../../docs-assets/ico/favicon.png">
# -*- coding: utf-8 -*-
import os, datetime, re
from flask import Flask, request, render_template, redirect, abort
from werkzeug import secure_filename
# import all of mongoengine
from flask.ext.mongoengine import mongoengine
# import data models
import models