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
{
"always_show_minimap_viewport": false,
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow-Night.tmTheme",
"draw_centered": false,
"font_face": "Ubuntu Mono",
"font_size": 16,
"ignored_packages":
[
"Vintage"
],
@bobbytables
bobbytables / rdio_volume_hack.js
Created May 21, 2014 17:02
This makes the Rdio volume slider larger so the ticks of volume control change the setting slightly less.
$('div.volume_wrapper').css({width: '150px'}).find('.Volume').css({width: '150px'})
Hardware Overview:
Model Name: MacBook Pro
Model Identifier: MacBookPro11,3
Processor Name: Intel Core i7
Processor Speed: 2.6 GHz
Number of Processors: 1
Total Number of Cores: 4
L2 Cache (per Core): 256 KB
L3 Cache: 6 MB
@bobbytables
bobbytables / json_generation_benches.rb
Last active August 29, 2015 14:07
Kartograph for JSON generation is fast.
require 'benchmark/ips'
require 'active_support/core_ext'
require 'jbuilder'
require 'kartograph'
require 'active_model_serializers'
require 'pry'
User = Struct.new(:id, :name, :email) do
def read_attribute_for_serialization(attribute)
send(attribute)
@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; }';
<?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>
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
@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
@bobbytables
bobbytables / questions.md
Created November 27, 2012 00:24
Repository Pattern questions

Attempting to find a good way to give a wrapper around AR objects to give them Repository pattern effects.

  • Do validations stay on the ActiveRecord model or do they move to the Repository object?

  • Is delegating attributes / errors / finders to the AR object bad?

    For example: UserRepository.new.errors => Calls user.errors ?

  • When calling associations (User => Comments), does the Repository return CommentRepository objects, or Comment objects?

@bobbytables
bobbytables / temporary_table.rb
Created December 1, 2012 01:08
Temporary Table class for creating a join table
class TemporaryTable
attr_reader :name_prefix, :attributes
def initialize(name_prefix, attributes)
@name_prefix = name_prefix
@attributes = attributes
create_temp_table!
end
def table_name