Skip to content

Instantly share code, notes, and snippets.

@danjac
danjac / gist:1315692
Created October 26, 2011 07:31
file upload
(ns file-uploadr.views.upload
(:require [file-uploadr.views.common :as common]
[noir.response :as res]
[noir.content.pages :as pages])
(:use noir.core
hiccup.core
hiccup.page-helpers
hiccup.form-helpers))
(defpage "/" []
@danjac
danjac / gist:8477954
Created January 17, 2014 17:46
Integration of wtforms 2 and Pyramid, including CSRF stuff.
from webob.multidict import MultiDict
from wtforms import Form as BaseForm
from wtforms.csrf.core import CSRF as BaseCSRF
class Form(BaseForm):
def __init__(self, request, formdata=None, *args, **kwargs):
{% extends "talent_solution/base_landing_page.html" %}
{% load talent_solution_tags %}
{% block header_img %}some_crappy_banner.png{% endblock %}
{% block header title %}Wow a new landing page{% endblock %}
{% block carousel %}
{# normally this is just DB-driven...#}
{% carousel 5 6 "blah" %}
{% endblock %}
"""
Join us at pitch x. x is a number between 1 and 553 such that the sum of
x's divisors (not including x) is greater than x but no subset of x's
divisors add up to exactly x
Run on Python 3.4.3
tl;dr; result was 70
"""
import itertools
import requests
url = "http://letsrevolutionizetesting.com/challenge"
while True:
data = requests.get(url, headers={"Accept":"application/json"})
json = data.json()
print(json)
if 'follow' in json:
url = json['follow']
package main
import (
"net/http"
"net/http/httputil"
"net/url"
)
func main() {
@danjac
danjac / adwaita.vimp
Created September 4, 2015 16:46
adwaita vimperator theme
hi Normal background: #e9e9e9; color:#215d9c;
hi CmdLine background: #e9e9e9; color:#215d9c;
hi CompGroup background: #e9e9e9; color:#215d9c;
hi CompTitle background: #dedede; font-weight: bold;
hi CompTitle>* color: #2e3436; padding: 1px 0.5ex; border-bottom: 2px solid #215d9c;border-top: 0.5px solid #d8d8d8;
hi CompItem background:#e9e9e9; color:#215d9c;
hi CompItem[selected] color: #ededed; background: #777;
hi CompDesc width: 500px; max-width: 500px; color: #465457;
hi CompDesc[selected] width: 500px; max-width: 500px; color: #ededed;
hi CompMsg margin-left: 16px; color: #215d9c;
defmodule Fizzbuzz do
def run do
Enum.each(1..100, fn(num) -> IO.puts(get_message(num)) end)
end
def get_message(num) do
cond do
rem(num, 15) == 0 -> "fizzbuzz"
rem(num, 5) == 0 -> "buzz"
@danjac
danjac / defender.html
Last active April 4, 2016 16:11
Defender test
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script src="https://code.jquery.com/jquery-2.2.2.min.js"></script>
</head>
<body>
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
/*
* Copyright Simon Lydell 2015, 2016.
*
* This file is part of VimFx.
*
* VimFx is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.