Skip to content

Instantly share code, notes, and snippets.

View use's full-sized avatar

Will Hall use

  • Eastern Washington University
  • WA, USA
View GitHub Profile
@use
use / gist:1756989
Created February 7, 2012 03:35
Post a card to Trello using the API
<?
$trello_key          = '123412341234123412341234';
$trello_api_endpoint = 'https://api.trello.com/1';
$trello_list_id      = '1234123412341234123412341234';
$trello_member_token = '12341234123412341234123412341234'; // Guard this well
 
$ch = curl_init("$trello_api_endpoint/cards");
curl_setopt_array($ch, array(
CURLOPT_SSL_VERIFYPEER => false, // Probably won't work otherwise
CURLOPT_RETURNTRANSFER => true, // So we can get the URL of the newly-created card
@use
use / madlibs-config.json
Created July 3, 2012 20:32
Madlibs Config
{
"madlibs": [
{
"title": "The Walking Story",
"text": "One day :name went for a walk to :place",
"fields": [
{
"title": "Someone's name",
"label": ":name"
},
@use
use / gist:3281745
Created August 7, 2012 04:52
Flask template example
{% extends "layout.html" %}
{% block body %}
<h1>Search Results</h1>
<ul>
{% for person in results %}
<li>
<a href="/person/{{ person.id }}">{{ person.first_name }} {{ person.last_name}}</a>
{{person.num_roles}}
</li>
{% endfor %}
@use
use / gist:5131941
Created March 11, 2013 04:43
See Flask profiling info
from werkzeug.contrib.profiler import ProfilerMiddleware
app = Flask(__name__)
app.wsgi_app = ProfilerMiddleware(app.wsgi_app)
@use
use / index.html
Created August 7, 2013 17:22
via:geojson.io
<!DOCTYPE html>
<html>
<head>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
.marker-properties {
border-collapse:collapse;
@use
use / thumbnail_calculate.py
Last active August 29, 2015 14:08
Find candidate thumbnail widths (x) and gap widths (y) with min/max constraints and fixed total width
def thumbnail_width_candidates(mingap, maxgap, minwidth, maxwidth, numitems, totalwidth):
return [
(x, y)
for y in range(mingap, maxgap)
for x in range(minwidth, maxwidth)
if
x%1==0 and
y%1==0 and
x*numitems + y*(numitems-1) == totalwidth
]
<?php
require_once __DIR__ . '/vendor/autoload.php';
$configuration = new Bolt\Configuration\Composer(__DIR__);
$configuration->setPath('cache', 'cache');
$configuration->setPath('config', 'app/config');
$configuration->setPath('database', 'app/database');
$configuration->setPath('files', 'content/files');
$configuration->setPath('web', 'content');
$app = new Bolt\Application(array('resources'=>$configuration));
@use
use / contenttypes.yml
Created May 1, 2015 22:14
sorting example for bolt contenttypes
homepage:
name: Homepage
slug: homepage
singular_name: Homepage feature
singular_slug: homepagefeature
fields:
title:
type: text
class: large
required: true
@use
use / contenttypes_schema.yml
Created October 19, 2015 23:44
Schema for bolt/bolt's contenttypes.yml file using romaricdrigon/MetaYaml
root:
_type: prototype
_prototype:
_type: array
_children:
default_status:
_type: enum
_values: [publish, held, draft, timed]
description:
_type: text
@use
use / menu_schema.yml
Created October 19, 2015 23:47
Schema for bolt/bolt's menu.yml file using romaricdrigon/MetaYaml
root:
_type: prototype
_prototype:
_type: partial
_partial: menu
partials:
menu:
_type: prototype
_prototype: