Open the postgresql.conf config file:
$> mate /usr/local/var/postgres/postgresql.conf
Uncomment the line with 'log_destination' and set it to 'syslog'
log_destination = 'syslog'
Open the syslog config:
CREATE EXTENSION pgcrypto; | |
CREATE OR REPLACE FUNCTION totp(key BYTEA, clock_offset INT DEFAULT 0) RETURNS INT AS $$ | |
DECLARE | |
c BYTEA := '\x000000000' || TO_HEX(FLOOR(EXTRACT(EPOCH FROM NOW()) / 30)::INT + clock_offset); | |
mac BYTEA := HMAC(c, key, 'sha1'); | |
trunc_offset INT := GET_BYTE(mac, 19) % 16; | |
result INT := SUBSTRING(SET_BIT(SUBSTRING(mac FROM 1 + trunc_offset FOR 4), 7, 0)::TEXT, 2)::BIT(32)::INT % 1000000; | |
BEGIN | |
RETURN result; | |
END; |
// knockout 2.2.1 | |
ko.utils.arrayFilter = function (array, predicate) { /* .. */ } | |
ko.utils.arrayFirst = function (array, predicate, predicateOwner) { /* .. */ } | |
ko.utils.arrayForEach = function (array, action) { /* .. */ } | |
ko.utils.arrayGetDistinctValues = function (array) { /* .. */ } |
Open the postgresql.conf config file:
$> mate /usr/local/var/postgres/postgresql.conf
Uncomment the line with 'log_destination' and set it to 'syslog'
log_destination = 'syslog'
Open the syslog config:
Choose a ticket class: <select id="tickets"></select> | |
<p id="ticketOutput"></p> | |
<script id="ticketTemplate" type="text/x-jquery-tmpl"> | |
{{if chosenTicket}} | |
You have chosen <b>${ chosenTicket().name }</b> | |
($${ chosenTicket().price }) | |
<button data-bind="click: resetTicket">Clear</button> | |
{{/if}} |
# Usage: show <local-port> <subdomain> | |
function show() { | |
DOMAIN=".tekacs.com" | |
REMOTE="$2$DOMAIN" | |
ssh -tR 1080:127.0.0.1:$1 vps "sudo ssh -Nl \$USER -L $REMOTE:80:127.0.0.1:1080 localhost" | |
} |
// knockout-jquery-ui-widget.js | |
// Copyright (c) 2011, Planapple, Inc. | |
// License: MIT (http://www.opensource.org/licenses/mit-license.php) | |
// | |
// Knockout binding for jQuery UI widgets | |
// | |
// Examples: | |
// <input type="submit" value="OK" data-bind='jqueryui: "button"' /> | |
// | |
// Attaches a jQuery UI button widget to this button, with default options. |
require 'uri' | |
require 'base64' | |
require 'openssl' | |
# NOTE: Oauth uses a specific unreserved character list for URL encoding. | |
def url_encode(input) | |
unreserved = '-._~0-9A-Za-z' # These are the only characters that should not be encoded. | |
URI.escape(input, Regexp.new("[^#{unreserved}]")) | |
end |
class ApplicationController < ActionController::Base | |
require 'postgresql_view_monkey' | |
end |
require 'rubygems' | |
require 'rack' | |
class Object | |
def webapp | |
class << self | |
define_method :call do |env| | |
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?) | |
[200, {}, send(func, *attrs)] | |
end |
module CouchDBAttachments | |
def attachment(*args) | |
lambda do |env| | |
request = ActionDispatch::Request.new(env) | |
doc = DocWithAttachments.get(request.params[:doc]) | |
serve_attachment(doc, request.params[:path]) | |
end | |
end | |
private |