Skip to content

Instantly share code, notes, and snippets.

View hunt3r's full-sized avatar

Chris Hunter hunt3r

View GitHub Profile
➜ pybuffalo git:(good) ab -v 1 -n 1000 -c 100 http://localhost:8888/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
{
"zones": [
{
"name": "Garbonzo Zone",
"trails": [
{
"status": {
"id": 0,
"name": "Open"
},
@hunt3r
hunt3r / gist:5954217
Created July 9, 2013 02:26
Just wrote this Whistler mountain bike trails scraper
{
"status": {
"id": 0,
"name": "Open"
},
"name": "Captain Safety",
"level": {
"difficulty": "Most Difficult",
"id": 3,
"name": "Double Black Diamond"
@hunt3r
hunt3r / gist:5781684
Created June 14, 2013 13:07
Vick function
$("*[data-view]").each(function(i,obj) {
var $this = $(this);
var viewDataAttr = $this.data("view");
if (app.views[viewDataAttr] && typeof(app.views[viewDataAttr]) === "function") {
console.log("Found view: " + viewDataAttr);
views.push(new app.views[viewDataAttr]);
}
});
app.views.ChallengesNav = Backbone.View.extend({
collection : new app.collections.Challenges(),
template : Handlebars.compile(app.templates.ChallengesNav),
initialize: function() {
//this.listenTo(this.collection, 'change', this.render);
_.bindAll(this, "render");
this.collection.fetch({
success: this.render
});
app.views.ChallengesNav = Backbone.View.extend({
collection : new app.collections.Challenges(),
template : Handlebars.compile(app.templates.ChallengesNav),
initialize: function() {
this.collection.bind('change', this.render(), this);
},
render: function() {
$('#challenge-nav').html(this.template({challenges : this.collection.models}));
import java.beans.Encoder;
import java.io.Serializable;
import java.net.URL;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
public class CategoryPersistance implements Serializable {
models/__init__.py:
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker
DBSession = scoped_session(sessionmaker(autoflush=True))
Base = declarative_base()
def initialize_sql(engine):
#!/usr/bin/env python
# By Chris Hunter
import random
import re
##
# getRandomSamplingOfEmails
# Returns a deduplicated random set of n length from a given m set of emails
# Uses regex to test for email address
# Safe for n less than 0, greater than length of given mSet
// handlers
handlersLoggedOut: function() {
var pm = this;
$('.media-item').draggable({
revert: true,
helper: 'clone',
cursor: 'move',
distance: 10,
start: function() {