Skip to content

Instantly share code, notes, and snippets.

View BrandonMathis's full-sized avatar
🌸
me like code

BrandonMathis BrandonMathis

🌸
me like code
View GitHub Profile
@BrandonMathis
BrandonMathis / gist:1203503
Created September 8, 2011 14:16
Example exported XML
<CCOMData xmlns="http://www.mimosa.org/osa-eai/v3-2-3-RC8/xml/CCOM-ML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Entity xsi:type="Enterprise">
<GUID>eaf1e000-d986-11e0-9572-0800200c9a66</GUID>
<IDInInfoSource>1029</IDInInfoSource>
<Tag>IOM-OG</Tag>
<Name>IOM-OG</Name>
<LastEdited>2009-07-03T13:30:00</LastEdited>
<Status>1</Status>
<Type>
<GUID>f1984c50-d986-11e0-9572-0800200c9a66</GUID>
@BrandonMathis
BrandonMathis / .htaccess
Created September 10, 2011 00:09
sinatra htaccess for bluehost
# General Apache options
AddHandler fcgid-script .fcgi
AddHandler cgi-script .cgi
#Options +FollowSymLinks +ExecCGI
# If you don't want Rails to look in certain directories,
# use the following rewrite rules so that Apache won't rewrite certain requests
#
# Example:
# RewriteCond %{REQUEST_URI} ^/notrails.*
@BrandonMathis
BrandonMathis / prospect
Created October 26, 2011 03:32
Build gem dependency list
#! /usr/bin/env ruby
require 'yaml'
gems = %x[bundle list]
f = File.open("dependencies.markdown", "w")
gems.each_line do |gem|
next unless gem =~ /\s*\*/
gemname = gem.split(' ')[1]
@BrandonMathis
BrandonMathis / gist:1315440
Created October 26, 2011 04:32
Register Dependencies
@BrandonMathis
BrandonMathis / gist:1317750
Created October 26, 2011 20:34
Print gems not found in a file
puts "Make sure without isn't excluding development or test"
%x[bundle install]
gems = %x[bundle list| grep -v included | awk '{print $2}']
gems = gems.split ' '
deps = open('dependencies.markdown').read
g = gems.delete_if { |gem| deps =~ /#{gem}/i }
puts g
.
./jquery-ea7d09f5540c98d6703b87765ffd1207.treeview.css.gz
./jquery-6c7bbd4740cfe27b968d29440fe2897f.treeview.js
./jquery-be87eb654a1c3e76f1cbe482237ed4df.serializeObject.js
./jquery-ea7d09f5540c98d6703b87765ffd1207.treeview.css
./application-1cd57a7746aca4302d45d3b7907fae80.css
./application-7a95be4b0bf0882850631fbe2e65b029.js
./jquery-ui-85f8033f6e4da5d0a32893f69d57c79b.min.js
./jquery-ui-85f8033f6e4da5d0a32893f69d57c79b.min.js.gz
./application-e8a869b29f6e33426c0903287b2833ff.js.gz
@BrandonMathis
BrandonMathis / post.rb
Created December 14, 2011 19:56
Users and posts
class Post < ActiveRecord::Base
attr_accessible :title, :body
belongs_to :user
end
@BrandonMathis
BrandonMathis / controller.rb
Created March 26, 2012 19:25
Render template to file to download
ini_string = render_to_string file: 'certificates/unlock'
send_data ini_string, filename: 'unlock.ini'
def youtube_embed(youtube_url)
if youtube_url[/youtu\.be\/([^\?]*)/]
youtube_id = $1
else
# Regex from # http://stackoverflow.com/questions/3452546/javascript-regex-how-to-get-youtube-video-id-from-url/4811367#4811367
youtube_url[/^.*((v\/)|(embed\/)|(watch\?))\??v?=?([^\&\?]*).*/]
youtube_id = $5
end
%Q{<iframe title="YouTube video player" width="640" height="390" src="http://www.youtube.com/embed/#{ youtube_id }" frameborder="0" allowfullscreen></iframe>}
nnoremap <Left> :echoe "Use h"<CR>
nnoremap <Right> :echoe "Use l"<CR>
nnoremap <Up> :echoe "Use k"<CR>
nnoremap <Down> :echoe "Use j"<CR>