Skip to content

Instantly share code, notes, and snippets.

development:
adapter: postgresql
database: samplrs_development
pool: 5
timeout: 5000
username: Sam
password:
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
require 'yaml'
d = Dir["./**/*.yml"]
d.each do |file|
begin
puts "checking : #{file}"
f = YAML.load_file(file)
rescue Exception
puts "failed to read #{file}: #{$!}"
end
<script>
if(window.opener) {
window.opener.location.reload(true);
window.close()
}
</script>
@sbauch
sbauch / boot nav stick
Created August 4, 2012 22:20
botostrap navbar sticky
<script> $("section[id]").each(function(idx, el){
var position = $(this).position();
$(this).scrollspy({
min: position.top + 40,
max: position.top + $(this).height(),
onEnter: function(element, position) {
if(console) console.log('entering ' + element.id);
$("div#navbar_to_change").addClass("navbar-fixed-top");
// if ( !primaryNav.hasClass("lock") ) {
// var navLi = $("ul#primary_nav a[href*='#"+element.id+"']").parent();
@sbauch
sbauch / bw.rb
Created August 6, 2012 18:30 — forked from clayallsopp/gist:3277152
having trouble with bubblewrap
#directory_controller.rb
class DirectoryController < UIViewController
def viewDidLoad
super
self.title = "Directory"
@table = UITableView.alloc.initWithFrame(self.view.bounds)
self.view.addSubview @table
@table.dataSource = self
@table.delegate = self
def self.seed_from_csv(uri)
CSV.read(uri).each do |row|
@post = Post.find_or_create_by_identifier(
:identifier => row[0],
:content => row[1],
:post_type => row[2],
:posted_at => row[5],
:post_impressions_unique => row[6],
:post_impressions_organic_unique => row[7],
validate :is_employee, :on => :create
def is_employee
if self.email.split("@")[1] == Settings.company_domain
#is employee, do nothing
else
# if i raise 'failed check'.inspect here I confirm that an @gmail.com does not satisfy the above conditional
errors.add(:email, "Not VM employee") #but then no matter what I put here the record still saves
end
end
@sbauch
sbauch / mobile.scss
Created April 28, 2013 15:41
WIP mobile stylesheet for Discourse
@media only screen and (max-device-width: 540px), only screen and (min-device-width: 560px) and (max-device-width: 1136px) and (-webkit-min-device-pixel-ratio: 2) {
body {
min-width: 320px !important;
max-width: 320px !important;
overflow: hidden;
}
.full-width{width:320px !important;}
#main-outlet {
padding-top: 95px !important;
}
@sbauch
sbauch / index.rb
Created May 6, 2013 23:39
this might help?
get '/' do
# Create Account
company_name = "Company_" + rand(1000000).to_s
new_account = Account.create(name: company_name)
# not sure whats going on here?
# new_account.name = "1 "+ company_name
# new_account.save!
# Create User
@sbauch
sbauch / gist:7874453
Created December 9, 2013 15:58
Programming Language Comparison for Sean
puts "Starting Launch Sequence..."
sleep 1
(1..10).to_a.reverse.each do |num|
puts num.to_s
sleep 1
end
puts "BLAST OFF!"