This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function grapp { | |
find ./app -name "*.rb" |xargs fgrep --color $1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CouchRestExt::Model | |
class << self | |
def make attributes={} | |
new(@_blueprint_block.call.merge(attributes)).tap do |obj| | |
yield obj if block_given? | |
obj.save | |
end | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module CouchRestExt | |
class Model < CouchRest::ExtendedDocument | |
include CouchRest::Validation | |
define_callbacks :validation | |
def valid?(context = :default) | |
_run_validation_callbacks do | |
self.class.validators.execute(context, self) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CouchRest::Database.class_eval do | |
def search query, options={} | |
CouchRest.get "#{@uri}/_fti?#{options.merge(:q => query).to_query}" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'json' | |
gem 'jchris-couchrest' | |
require 'couchrest' | |
require 'open3' | |
COUCHDB_HOST = "http://127.0.0.1:5984" | |
DB_NAME = 'tweet-spritzer' | |
SPRITZER_DB = CouchRest.database! "#{COUCHDB_HOST}/#{DB_NAME}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dir.glob('**/*.rhtml') do |rhtml_path| | |
new_path = rhtml_path.gsub /^(.*)\.rhtml$/, '\1.erb.html' | |
`git mv #{rhtml_path} #{new_path}` | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head><title>Commit All Databases</title></head> | |
<body> | |
<h1>Commit All Databases</h1> | |
<p>This script will trigger <tt>_ensure_full_commit</tt> on all databases.</p> | |
<ul id="databases"></ul> | |
</body> | |
<script src="/_utils/script/jquery.js"></script> | |
<script src="/_utils/script/jquery.couch.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ npm install request | |
npm it worked if it ends with ok | |
npm cli [ 'install', 'request' ] | |
npm version 0.1.23 | |
npm config file /Users/zach/.npmrc | |
npm config file /usr/local/Cellar/node/0.1.103/etc/npmrc | |
npm install pkg request | |
npm fetch data request | |
npm GET request | |
npm install pkg request |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl http://npmjs.org/install.sh | sudo sh | |
% Total % Received % Xferd Average Speed Time Time Time Current | |
Dload Upload Total Spent Left Speed | |
115 230 115 230 0 0 5385 0 --:--:-- --:--:-- --:--:-- 11500 | |
% Total % Received % Xferd Average Speed Time Time Time Current | |
Dload Upload Total Spent Left Speed | |
100 553k 100 553k 0 0 150k 0 0:00:03 0:00:03 --:--:-- 165k | |
node cli.js cache clean | |
npm it worked if it ends with ok | |
npm cli [ 'cache', 'clean' ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Error: Couch response 500 to http://devadmin:foo@localhost:5984/cqs-development/CQS%2FZachary-Zoltons-MacBook-Air-local-development%2F2f7a20debd8f40d9629898d584a30a94: {"error":"case_clause","reason":"{[{<<\"message\">>,<<\"/^CQS\\\\//.test is not a function\">>},\n {<<\"fileName\">>,<<>>},\n {<<\"lineNumber\">>,18},\n {<<\"stack\">>,\n <<\"([object Object],null,[object Object],[object Object])@:18\\n(function (newDoc, oldDoc, userCtx, secObj) {var NAME = \\\"Zachary-Zoltons-MacBook-Air-local-development\\\";var my_msg_id = function (doc) {var for_me = /^CQS\\\\/Zachary-Zoltons-MacBook-Air-local-development\\\\/(.*)$/;var match = for_me.exec(doc._id);if (!match) {return null;}var msg_id = match[1];match = /^([0-9a-f]{32})($|\\\\/(.*)$)/.exec(msg_id);if (!match) {throw {forbidden: \\\"Invalid message id: \\\" + msg_id};}return {id: match[1], extra: match[3]};};if (!/^CQS\\\\//.test(newDoc._id)) {throw {forbidden: \\\"This database is for CQS only\\\"};}var msg_id = mpg-api |
OlderNewer