Skip to content

Instantly share code, notes, and snippets.

@pawl
pawl / guess_product_attributes.txt
Last active May 23, 2016 03:31
Stats from guess_product_attributes script
Percent Error: 7.11057547454
Correct Total: 3083
Incorrect Total: 236
Incorrect count by product type:
Facial Tissue: 36
Body Wash: 31
Hand Soap: 20
Dishwasher Detergent Tablets: 15
Flushable Wipes: 15
@pawl
pawl / datatable.html
Created May 21, 2016 03:38
datatables no error popups
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
@pawl
pawl / example.json
Last active May 2, 2016 07:44
JSON data example
{
"localization": {
"currency_code": "USD"
},
"products": {
"1": {
"attributes": {
"Rolls": 24,
"Sheet Height": 11,
"Sheet Width": 7,
@pawl
pawl / mac_setup.md
Last active November 25, 2024 23:31
New Mac Setup

Important tips:

  • to open applications quickly, command + space and type the application name
  • mac doesn't have an address bar in finder, you need to use command + shift + g to type a directory path
  • mac doesn't have "snap window to screen" like windows does, you need to install moom for this
  • activity monitor = task manager
  • brew install = apt get install (you'll need to install brew)
  • use command + tilde to switch between windows for the same application

Setup:

  • Upgrade MacOS to newest through the app store if you haven't already
@pawl
pawl / gist:b7d3ba6b8721d878be506be335a526c0
Created April 7, 2016 03:12
ambiguous column error flask-admin
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
import flask_admin as admin
from flask_admin.contrib import sqla
# Create application
app = Flask(__name__)
@pawl
pawl / gist:589c3fd158557139737a78d3c73bfec0
Created April 7, 2016 02:35
flask-admin testing field with length defined
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
import flask_admin as admin
from flask_admin.contrib import sqla
# Create application
app = Flask(__name__)
@pawl
pawl / date_filter_admin.py
Last active March 5, 2016 04:43
date filter flask-admin
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
import flask_admin as admin
from flask_admin.contrib import sqla
# Create application
app = Flask(__name__)
# Create dummy secrey key so we can use sessions
@pawl
pawl / whmcs.php
Created January 16, 2016 06:16
Example of a WHMCS hook code using WHMCS's new "The Connection Manager"
<?php
use Illuminate\Database\Capsule\Manager as Capsule;
function create_ldap_account($vars) {
$userid = $vars['userid'];
$criteria = array('fieldid' => '2', 'relid' => $userid);
$result = Capsule::table('tblcustomfieldsvalues')->where($criteria)->first();
$username = $result->value;
}
@pawl
pawl / gist:7d6064aebac5ed9eb2b8
Created December 23, 2015 10:58
incomplete appengine example
import flask_admin as admin
from flask import Flask
from flask_admin.contrib import appengine
from google.appengine.ext import ndb
# Create application
app = Flask(__name__)
# Create dummy secrey key so we can use sessions
@pawl
pawl / s3.py
Created December 22, 2015 22:59
testing new s3 storage backend for flask-admin
import os
import os.path as op
from flask import Flask
import flask_admin as admin
from flask_admin.contrib.fileadmin import BaseFileAdmin
from flask_admin.contrib.fileadmin.s3 import S3Storage
# Create flask app