Skip to content

Instantly share code, notes, and snippets.

View ssherar's full-sized avatar

Sam Sherar ssherar

View GitHub Profile
@ssherar
ssherar / commit-msg
Last active August 29, 2015 14:16
Looks for refs, closes or fixes in your commit message
FOUND=$( grep -iE "(refs|closes|fixes)" "$1" )
BRANCH=$( git rev-parse --abbrev-ref HEAD | grep -Eo '[0-9]+' )
if [[ -n $BRANCH ]] && [[ -z $FOUND ]]; then
echo "\033[1;34m > Found an issue within the branch, defaulting to $BRANCH \033[0m"
sed -i "" "2i\\
refs #$BRANCH
" $1
exit 0
elif [[ -z $FOUND ]]; then
@ssherar
ssherar / default.yml
Last active August 29, 2015 14:17
Config for a hook receive library
default:
all:
return: "Request worked"
on_error: "Shit failed {error_msg}"
create:
pulL_repo: true
delete:
pull_repo: true
pull_request:
pull_repo: true
<?php
require_once 'NikePlusPHP.php';
function login($user,$pass){
$n = new NikePlusPHP($user, $pass);
return $n;
}
function flatten(array $array) {
$return = array();
from flask import Flask, render_template, request
import nikeplus
app = Flask(__name__) # creates the application body
@app.post("/nikeplus/activity")
def nike_activity():
data = request.post.data
username = data["username"]
password = data["password"]
@ssherar
ssherar / app.py
Last active August 29, 2015 14:21
from flask import Flask, render_template, request, g, redirect
# Set up the app yo
app = Flask(__name__)
# Responds to only GET on the root URL
# and renders the index.tpl as part of the return
# all methods "decorated" witn the @app
# /HAVE/ to return something
@app.route("/", methods=["GET"])
1 import os, sys
2 import pygame
3 from pygame.locals import *
4
5 class Game(object):
6
7 def __init__(self, width=640, height=480):
8 pygame.init()
9 self.width = width
10 self.height = height

Current endpoints implemented:

GET :8000/v1/ - returns version {"version": "0.0.1"}

POST :8000/v1/story - submits a new story (1)

{"status": "200", "message": "submitted"}

GET :8000/v1/story/list/approved - returns last 10 stories which are approved