This file contains hidden or 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
#!/usr/bin/env ruby | |
require 'trello' # ruby-trello gem | |
require 'csv' | |
# | |
# export TRELLO_DEVELOPER_PUBLIC_KEY=yourkeyfrom # https://trello.com/app-key | |
# export BOARD_NAME=nameofboardtoimportto | |
# export MEMBER_NAME=yourusername |
This file contains hidden or 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
#!/bin/bash | |
BACKUP="/tmp/s3/db" | |
DATE=`date +"%Y-%m-%d"` | |
DIR="${BACKUP}/${DATE}/" | |
if [ ! -d $DIR ]; | |
then | |
mkdir -p $DIR | |
fi |
This file contains hidden or 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 Sunspot | |
module DataMapper | |
def self.included(base) | |
base.class_eval do | |
alias new_record? new? | |
end | |
base.extend Sunspot::Rails::Searchable::ActsAsMethods | |
Sunspot::Adapters::DataAccessor.register(DataAccessor, base) |
This file contains hidden or 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
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 > Vehicle.new(:horsepower => 300, :top_speed_mph => 180).save | |
=> true |
This file contains hidden or 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
# 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 | |
# |
This file contains hidden or 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
# tpitale_rails_template.rb | |
file 'config/routes.rb', <<-CODE | |
ActionController::Routing::Routes.draw do |map| | |
end | |
CODE | |
run "rm public/index.html" | |
run "rm public/images/rails.png" | |
run "rm public/favicon.ico" |
This file contains hidden or 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
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]; |
This file contains hidden or 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 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 |
This file contains hidden or 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
#!/usr/bin/env ruby | |
# | |
# A one file test to show ... | |
require 'rubygems' | |
require 'dm-core' | |
# setup the logger | |
DataMapper::Logger.new(STDOUT, :debug) |