Skip to content

Instantly share code, notes, and snippets.

@pritchie
pritchie / gist:5879258
Created June 27, 2013 18:51
test jsp

very basic jsp

  <%@ page session="false" %><% response.setContentType("text/plain; charset=UTF-8"); %>
  ${message}

this is my init

# minimal compass configuration and run in voldemort
Compass.configuration.images_dir = 'sprites'
Compass.configuration.css_dir = 'css'
Compass.configuration.sass_dir = 'sass'
# this takes a little while on the first pass to parse all the sprites
# subsequent passes are fast
Compass.compiler.run
module AwesomeResource
attr_reader :awesome_attributes
def initialize(attributes={})
@awesome_attributes = attributes # AwesomeResource::Attributes.new attributes
define_attribute_accessors
end
private
# ruby 1.9
# -*- coding: us-ascii -*-
s = '%s'
puts s.encoding # => US-ASCII
utf8_string = File.read('utf8_file')
puts utf8_string.encoding # => UTF-8
puts (s % utf8_string).encoding # => UTF-8
puts (s + utf8_string).encoding # => UTF-8
@pritchie
pritchie / gist:1727138
Created February 3, 2012 01:49 — forked from francois/gist:1712533
SQL to create the events table for the SQL Workshop on February 2nd
CREATE TEMPORARY TABLE events(
step text primary key
, start_at timestamp without time zone not null
);
INSERT INTO events VALUES
('Startup', '2011-10-01 02:00:00')
, ('Find Unique Personas', '2011-10-01 02:01:13')
, ('Calculate Loyalty', '2011-10-01 02:01:41')
, ('Calculate Social Impressions', '2011-10-01 02:02:38')
def f n;n<3?1:f(n-1)+f(n-2);end;def fibsum n;(1..n).inject{|s,i|s+=f i};end
def ccexp? d;m,y=d.split"/";y[0]==48||y=="10"&&m.to_i<7;end
def mask c;c[6,l=c.size-10]='*'*l;c;end
def mask n;n.size<=6?n:n[0,6]+'*'*(n.size>=10?n.size-10:10-n.size)+n[-4,n.size>=10?4:0]end