Skip to content

Instantly share code, notes, and snippets.

@fidothe
fidothe / cookieblind.rb
Created July 11, 2011 16:40
Stop getting confused by cookies by making your app cookie-blind
class Cookieblind
def initialize(app)
@app = app
end
def call(env)
request = Rack::Request.new(env)
unless request.post?
env.delete("HTTP_COOKIE")
end
#!/bin/bash
gem install bundler
git clone git://github.com/fidothe/pub_finder_general.git
cd pub_finder_general
bundle install
@fidothe
fidothe / gist:1373175
Created November 17, 2011 13:50
Error running brew upgrade
Beor:web matt$ brew doctor
Your system is raring to brew.
Beor:web matt$ brew update
Initialized empty Git repository in /usr/local/.git/
remote: Counting objects: 48129, done.
remote: Compressing objects: 100% (21364/21364), done.
remote: Total 48129 (delta 30245), reused 41934 (delta 26093)
Receiving objects: 100% (48129/48129), 6.87 MiB | 1.00 MiB/s, done.
Resolving deltas: 100% (30245/30245), done.
From https://github.com/mxcl/homebrew
@fidothe
fidothe / schema.xml
Created November 24, 2011 14:28
Snippet of my Solr config
<schema name="Trigram" version="1.4">
<!-- this is heavily truncated, but I hope it has the relevant stuff in -->
<types>
<fieldType name="title_trigram" class="solr.TextField"
positionIncrementGap="100" stored="false" multiValued="true">
<analyzer type="index">
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.NGramFilterFactory" minGramSize="3"
maxGramSize="3"/>
@fidothe
fidothe / sudoers
Created December 6, 2011 12:37
the line that gives a user passwordless sudo, because I keep getting it wrong...
ubuntu ALL=(ALL) NOPASSWD:ALL
sudo virt-install -r 512 --accelerate -n test-ubuntu -f /dev/guests/test \
--location=http://archive.ubuntu.com/ubuntu/dists/oneiric/main/installer-i386/ \
--nographics --os-variant=ubuntuoneiric \
--extra-args="serial console=tty0 console=ttyS0,115200"
# /dev/guests/test is an LVM volume
class dev {
class {
postgresql: before => Class[python];
python: before => Class[geo_django_deps];
}
}
(make_mozilla)Gad:make.mozilla.org matt$ python manage.py shell
Python 2.6.7 (r267:88850, Jul 31 2011, 19:30:54)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import commonware.log
>>> log = commonware.log.getLogger('mk.tasks')
>>> log.info('HELLZ YEAH')
>>> from make_mozilla.base.decorators import log_execution
>>> log_execution(log.error)
@fidothe
fidothe / gist:4079894
Created November 15, 2012 17:21
Is this just libxml's XML Schema support being incomplete?
Failure/Error: @validator = Nokogiri::XML::Schema(File.open(schema_dir.join("Payment.xsd")))
Nokogiri::XML::SyntaxError:
Element '{http://www.w3.org/2001/XMLSchema}include': The schema document '/Users/matt/Documents/work/current/xeroid/vendor/XeroAPI-Schemas/v2.00/Payment.xsd' cannot be included or redefined, since it was already imported.
Payment.xsd: https://github.com/XeroAPI/XeroAPI-Schemas/blob/master/v2.00/Payment.xsd
  • Strings
  • Arrays
  • Hashes
  • Classes
  • Conditionals (if)
  • Conditional (case)
  • Modules (for mixins)
  • Namespaces
  • requiring
  • Gems