Skip to content

Instantly share code, notes, and snippets.

View bobbytables's full-sized avatar
🔥
Putting out fires

Robert Ross bobbytables

🔥
Putting out fires
View GitHub Profile
@bobbytables
bobbytables / README.md
Created September 10, 2012 03:59
Some general steps that I use with turnip to help crank out feature specs

I find that writing features can get really repetitive. So to get rid of writing steps over and over again for multiple models I decided to create a pretty simple solution. It's not big enough to yield a gem so it's here for your use / modification. Comments or questions are welcome, would love to add to this as well.

The steps

step 'I modify the :model :attribute with/to :value' do |model_name, attribute, value|
  id = "#{model_name}_#{attribute}"
  fill_in "#{id}", with: value
export GIT_EDITOR="subl -w"
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
c_reset=`tput sgr0`
c_user=`tput setaf 6`
c_path=`tput setaf 7; tput bold`
c_black=`tput setaf 0`
c_git_clean=`tput setaf 2`
c_git_dirty=`tput setaf 1`
else
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Folder>
<name>House of Blues</name>
<Placemark>
<name>HOB San Diego</name>
<description />
<Point>
<coordinates>-117.160118,32.716254</coordinates>
<description>1055 5th Ave, San Diego, CA 92101, USA</description>
@bobbytables
bobbytables / search_log.php
Created April 20, 2011 17:12
We needed a way to Map/Reduce our search queries in CakePHP shells. This is our result. Built off of the incredible plugin, https://github.com/ichikaway/cakephp-mongodb
<?php
public function startup(){
App::import('Datasource', 'Mongodb.Mongodb');
$this->mongo = ConnectionManager::getDataSource($this->SearchLog->useDbConfig);
}
public function main(){
$map = 'function () { emit(this.slug, {count:1}); }';
$reduce = 'function (key, values) { var count = 0; values.forEach(function (v) {count += v.count;}); return count; }';