Skip to content

Instantly share code, notes, and snippets.

View trello-cards-from-csv.rb
#!/usr/bin/env ruby
require 'trello' # ruby-trello gem
require 'csv'
# export TRELLO_DEVELOPER_PUBLIC_KEY=yourkeyfrom #
# export BOARD_NAME=nameofboardtoimportto
# export MEMBER_NAME=yourusername
View gist:114857
#!/usr/bin/env ruby
# A one file test to show ...
require 'rubygems'
require 'dm-core'
# setup the logger, :debug)
View gist:114964
class GameMode
include DataMapper::Resource
property :id, Serial
property :title, String
property :description, Text
property :max_players, Integer
has n :games, :through => Resource
has n, :types, :through => Resource
View gist:151540
cookies = document.cookie.split(';');
utmz = "";
for(i in cookies) {
if(cookies[i].test(/^__utmz/)) utmz = cookies[i];
medium = utmz.match(/".*?utmcmd=([a-z]+)\|/)[1];
adwords = utmz.match(/.*?utmgclid=([_0-9A-Za-z]+)\|/)[1];
View tpitale_rails_template.rb
# tpitale_rails_template.rb
file 'config/routes.rb', <<-CODE
ActionController::Routing::Routes.draw do |map|
run "rm public/index.html"
run "rm public/images/rails.png"
run "rm public/favicon.ico"
View redis_pubsub_demo.rb
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
# - a browser with WebSocket support
# Usage:
# ruby redis_pubsub_demo.rb
View gist:660264
ruby-1.8.7-p299 > class Vehicle
ruby-1.8.7-p299 ?> include Mongoid::Document
ruby-1.8.7-p299 ?> field :horsepower
ruby-1.8.7-p299 ?> field :top_speed_mph
ruby-1.8.7-p299 ?> end
=> nil
ruby-1.8.7-p299 > => 300, :top_speed_mph => 180).save
=> true
tpitale / lib-sunspot-data_mapper.rb
Created Oct 16, 2011 — forked from dkubb/dm_sunspot.rb
DataMapper and Sunspot Integration Extension
View lib-sunspot-data_mapper.rb
module Sunspot
module DataMapper
def self.included(base)
base.class_eval do
alias new_record? new?
base.extend Sunspot::Rails::Searchable::ActsAsMethods
Sunspot::Adapters::DataAccessor.register(DataAccessor, base)
tpitale /
Last active Dec 19, 2015 — forked from bkenny/
Simple shell script to backup each postgresql database to s3.
DATE=`date +"%Y-%m-%d"`
if [ ! -d $DIR ];
mkdir -p $DIR
You can’t perform that action at this time.