Skip to content

Instantly share code, notes, and snippets.

require 'rubygems'
require 'camping'
require 'camping/ar'
require 'camping/session'
require 'redcloth'
require 'xml/mapping'
Camping.goes :CSRFExperiment
module CSRFExperiment
gem "haml", ">= 3.0.12"
gem "factory_girl"
gem "rspec-rails", ">= 2.0.0.beta.15", :group => :test
generators = <<-GENERATORS
config.generators do |g|
g.orm :active_record
g.template_engine :haml
g.test_framework :rspec, :fixture => false, :views => false
g.fixture_replacement :factory_girl
@jaakkos
jaakkos / gist:1239088
Created September 24, 2011 07:48
Dashboard template
Template:
<script id="competition-dashboard-template" type="text/x-handlebars-template">
{{#competitionCompleted this}}
<h1>Done</h1>
{{else}}
<h1>Not Done</h1>
{{/competitionCompleted}}
{{#loginPanel}}
# Origin of etag_matches? https://github.com/rails/rails/blob/7511f9794df8f803f28306d378f9fefc28165886/actionpack/lib/action_dispatch/http/cache.rb
module ActionController
class Request
alias_method :etag_matches_original?, :etag_matches?
def etag_matches?(etag)
!env['HTTP_USER_AGENT'].include?('MSIE') && etag_matches_original?(etag)
@jaakkos
jaakkos / rdf-events.xml
Created April 18, 2012 06:48
ToimintaSuomi.fi Events sample
<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:ical="http://www.w3.org/2002/12/cal/icaltzd#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:tosu="http://purl.org/finnonto/schema/toimintasuomi/"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xs="http://www.w3.org/2001/XMLSchema#">
<ical:Vevent rdf:about="http://www.sydan.fi/web/sydan-verkkolehti/tapahtumat?id=769">
<ical:summary xml:lang="fi">Tahdistinkerhon luento Turussa</ical:summary>
<ical:description xml:lang="fi">Tahdistinkerhon luento Turussa</ical:description>
<tosu:content xml:lang="fi" rdf:parseType="Literal" xmlns="http://www.w3.org/1999/xhtml">
var find_out_meaning_of_life = function (is_it, callback) {
var meaning_of_life = 42;
try {
setTimeout(function () {
callback(null, (is_it === meaning_of_life))
}, 420);
} catch(err) {
callback(err, 'FAIL!');
}
};
package = "Ledge"
version = "1.0"
source = {
url = "git://github.com/pintsized/ledge.git"
}
description = {
summary = "Network support for the Lua language",
}
build = {
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: nginx init.d dash script for Ubuntu <=9.10.
# Description: nginx init.d dash script for Ubuntu <=9.10.
### END INIT INFO
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
@jaakkos
jaakkos / winston-logstash.conf
Last active August 29, 2015 14:09
winston-logstash integration test configuration file.
input {
stdin {
type => "stdin-type"
}
tcp {
port => 28777
host => "0.0.0.0"
type=>"sample"
}
}