Skip to content

Instantly share code, notes, and snippets.

View trevrosen's full-sized avatar
🦆
herding bits

Trevor Rosen trevrosen

🦆
herding bits
View GitHub Profile
#! /usr/bin/env ruby
require "rubygems"
require "hpricot"
# File to alter and suffix to add
HEADER_FILE = "/path/to/your/file"
suffix = "?time=" + Time.now.strftime('%Y%m%d%H%M%S')
# Use Hpricot to open and parse file as well as to find path
# --------------------- POST handler -- processes the form submission -----------------------
post "/post" do
# Instantiate the Submission to get the party started
sub = Submission.new(params,
request.env['HTTP_REFERER'],
request.env['REMOTE_ADDR']
)
debugger
$: << File.join(File.dirname(__FILE__), '..')
begin
require "spec"
require "spec/interop/test"
require 'rack/test'
require "proxy"
require "libxml"
Test::Unit::TestCase.send :include, Rack::Test
rescue LoadError => error
ZPROXY_CONFIG = Hash.new
# General config
configure do
gems = %w(activerecord logger hpricot open-uri resolv restclient net/http yaml rexml/document rack-flash mailfactory json net/smtp)
zproxy_libs = %w(submission validator webex)
(gems + zproxy_libs).each do |dependency|
begin
require dependency
# Booting ----
$: << File.join(File.dirname(__FILE__), 'lib')
$: << File.join(File.dirname(__FILE__), 'routes')
$: << File.join(File.dirname(__FILE__), 'helpers')
SINATRA_ROOT = File.expand_path(File.dirname((__FILE__))) unless defined? SINATRA_ROOT
require "rubygems"
require "sinatra"
require 'config/config'
# /Booting ----
## Provides a list of attendees based on meeting ID
get '/list-attendees/:meeting_id' do
w = WebEx::Request.new
attendees = w.lst_meeting_attendee(params[:meeting_id])
if attendees[:response][:result] == "SUCCESS"
@attendees = attendees[:body]
erb :list_attendees, :layout => false
else
LOGGER.warn('Problem obtaining meeting information')
end
module WebEx
## Convenience methods
def self.filter_by_session_name(collection, name=nil)
return collection unless name
collection.collect{|session|
session if session['sessionName'].downcase.include?(name)
}.compact
end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Colors</key>
<dict>
<key>Background</key>
<string>0.044 0.063 0.129</string>
<key>InsertionPoint</key>
<string>1.000 1.000 1.000</string>
# Automatically insert closing parens, braces, etc
vim_plugin_task "autoclose", "git://github.com/Townk/vim-autoclose.git"
# Bunch of nice snippets for Snipmate
vim_plugin_task "scrooloose-snippets" do
snippet_dirs = %w(ruby-rspec javascript-jquery html haml) # dirs w/ snippets you want
storage_path = File.expand_path("~/.vim/extra_snippets", __FILE__)
snipmate_path = File.expand_path("~/.vim/snippets", __FILE__)
@trevrosen
trevrosen / gist:4708561
Created February 4, 2013 18:31
My terminal prompt, adapted from another oh my zsh theme
export LSCOLORS="Dxfxcxdxbxegedabagacad"
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}'
local git_branch='$(git_prompt_info)%{$reset_color%}'
PROMPT="╭─${user_host}${current_dir} ${git_branch}
╰─%B$%b "
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[magenta]%}‹"