Skip to content

Instantly share code, notes, and snippets.

View nkryptic's full-sized avatar

Jacob Radford nkryptic

  • New York, NY, USA
View GitHub Profile
@nkryptic
nkryptic / gist:39799
Created December 24, 2008 22:27 — forked from peterc/gist:33337
# SUPER DARING APP TEMPLATE 1.0
# By Peter Cooper
# Link to local copy of edge rails
inside('vendor') { run 'ln -s ~/dev/rails/rails rails' }
# Delete unnecessary files
run "rm README"
run "rm public/index.html"
run "rm public/favicon.ico"
[fss]
recipe = iw.recipe.fss
# zeoclient1 and zeoclient2 are the names of you buildout parts for your zeo clients
# you just need a line for each zeo client you have in your buildout
zope-instances =
${zeoclient1:location}
${zeoclient2:location}
storages =
global / directory ${buildout:directory}/var/fss/storage ${buildout:directory}/var/fss/backup
## NOTE
The error refers to the first line of the second multi-line pre-scenario comments
## sessions.feature file
Users want to know that nobody can masquerade as them. We want to extend trust
only to visitors who present the appropriate credentials. Everyone wants this
identity verification to be as secure and convenient as possible.
Feature: Logging in
## NOTE
the error line indicates the second commented-out And line below, not the first
## account_activation.feature
Visitors may create an account, but for those who are not already in the
system an someone must activate the account for them before it can be used.
Feature: Activating an account
As a registered, but not yet activated, user
## in my env.rb (only part of it)
require 'webrat'
Webrat.configure do |config|
config.mode = :rails
config.open_error_files = false
end
class Webrat::Session
Users want to use cucumber, so tests are necessary to verify
it is all working as expected
Feature: Using the Console Formatter
In order to verify this error
I want to run this feature using the progress format
So that it can be fixed
Scenario: A normal feature
Given I have a pending step
@nkryptic
nkryptic / mocha.rb
Created March 20, 2009 04:13 — forked from drnic/mocha.rb
# For mocha integration, add this file into features/support folder
require "mocha"
World { |world| world.extend Mocha::Standalone }
Before do
mocha_setup
end
# Allow the metal piece to run in isolation
require( File.dirname(__FILE__) + "/../../config/environment" ) unless defined?(Rails)
class PassengerRestarter
@restart_url = "/restart"
@default_target = "/"
@restart_message = "Restarted."
@set_flash = true
def self.call(env)
@nkryptic
nkryptic / multifield_filter.py
Created February 7, 2013 02:17
A proof of concept for a multifield filter for django-filter. The logic is primarily based on the search mechanism from Django's admin.
import operator
from django.db.models import Q
from django_filters import CharFilter
class MultiFieldFilter(CharFilter):
"""
This filter preforms an OR query on the defined fields from a
single entered value.
@nkryptic
nkryptic / example_test_and_test_model_changes.py
Last active December 12, 2015 12:19
found out that django-filter doesn't handle the reverse side of model relationships... it looks like there was some intent to, but the code breaks when attempting it and there are no tests which try it. this is a patch which handles those special cases. pretty rough though, at this point.
# updated models.py
class User(models.Model):
username = models.CharField(max_length=255)
first_name = models.CharField(max_length=100)
last_name = models.CharField(max_length=100)
status = models.IntegerField(choices=STATUS_CHOICES, default=0)
is_active = models.BooleanField()
# modified m2m to have related_name
favorite_books = models.ManyToManyField('Book', related_name='likers')