Skip to content

Instantly share code, notes, and snippets.

This file has been truncated, but you can view the full file.
function html5ModeConfig(e) {
window.history && history.pushState ? e.html5Mode(!0) : e.html5Mode(!1).hashPrefix("!")
}
function toBoolean(e) {
if (e && 0 !== e.length) {
var t = angular.lowercase("" + e);
e = !("f" == t || "0" == t || "false" == t || "no" == t || "n" == t || "[]" == t)
} else e = !1;
return e
@ajford
ajford / Output.txt
Last active March 8, 2017 21:36
Ulmo CPC year issue (ulmo-dev/ulmo #144)
$ python demo.py
-- Tail of dataframe --
state climate_division period cmi
625 TX 6 2017-03-05/2017-03-11 2.34
626 TX 7 2017-03-05/2017-03-11 2.78
627 TX 8 2017-03-05/2017-03-11 3.20
628 TX 9 2017-03-05/2017-03-11 0.13
629 TX 10 2017-03-05/2017-03-11 0.12
-- Last two records are identical (except date is shifted) --
@ajford
ajford / Readme.mkd
Created December 25, 2016 02:09
Systemd service file for justseed.it downloader

This gist assumes the justseedit pieces downloader jar is placed in a directory named .justseedit within the home directory of a user with a username of user. Feel free to change this location to wherever you please.

It also assumes that /usr/bin/java/ is a compatible java implementation (at the time of writing, Oracle JRE 8).

It is recommended that you run the downloader manually via java -jar first, so you can verify that it's functioning correctly first. Don't forget you will need to modify the settings/api.txt and settings/piece_downloader.txt with your settings (at minimum the api key for your account.

If you wish to use the justseed.it downloader instead of the pieces downloader, you can change line 6 of the service file

@ajford
ajford / wtformstest.py
Created May 19, 2016 19:14
Example demonstrating the use of WTForms keyword arguments to set disabled state
import wtforms as wtf
class MyForm(wtf.Form):
sel = wtf.SelectField('Select',choices=[(1,'One'),(2,'Two')],
default=1)
class MyDisabledForm(wtf.Form):
sel1 = wtf.SelectField('Select',choices=[(1,'One'),(2,'Two')],
default=1,render_kw={'disabled':'disabled'})
sel2 = wtf.SelectField('Select',choices=[(1,'One'),(2,'Two')],
@ajford
ajford / App dir
Created May 5, 2016 17:23
uwsgi/nginx example
/var/www/apps
├── FoobarApp/
│ └── foobar/
│ ├── __init__.py
│ ├── static/
│ │ ├── imgs/
│ │ │ └── favicon.ico
│ │ └── js/
│ │ ├── admin.js
│ │ ├── common.js
@ajford
ajford / unblock_analytics
Last active August 29, 2015 14:21
Unblock analytics on uBlock
@@||google-analytics.com^
@@||customer.io^
@@||optimizely.com^
@@||kissmetrics.com^
@ajford
ajford / .ycm_extra_conf.py
Last active April 12, 2021 11:55
PlatformIO/YouCompleteMe Integration
"""
YouCompleteMe extra configuration for Platformio based
projects.
Based on the `.ycm_extra_conf.py` by @ladislas in his Bare-Arduino-Project.
Anthony Ford <github.com/ajford>
"""
import os
@ajford
ajford / Vagrantfile
Last active August 29, 2015 14:08
Vagrant mount issue
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "box-cutter/centos64-i386"
@ajford
ajford / app.py
Last active September 7, 2019 03:56
Flask MethodView test
from flask import (Flask, Blueprint)
from flask.views import MethodView
DEBUG = True
app = Flask(__name__)
class TestAPI(MethodView):
"Testing Flask MethodView"
@ajford
ajford / post-recieve
Created October 26, 2012 03:41
Static site deployment via git post-receive hook
#!/bin/sh
# Deploy hook for static sites (or similar application).
#
# Written by Anthony Ford <ford.anthonyj@gmail.com>
#
# Essentially clones the repo into a directory then removes
# the git related files.
REPO_DIR=`pwd`