Skip to content

Instantly share code, notes, and snippets.

@tdm00
tdm00 / gist:1207477
Created September 9, 2011 22:18
Bootstrap Floating Top-bar
<div>
<div class="topbar">
<div class="topbar-inner">
<div class="container">
<ul class="nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle">Dropdown</a>
<ul class="dropdown-menu">
<li><a href="#">Item1</a></li>
<li><a href="#">Item2</a></li>
@tdm00
tdm00 / gist:4b05d114dc0441eb68f2ed45c0e1d657
Created January 30, 2019 15:28
Postman Pre-request Script for Akamai OPEN
var AccessToken;
var BaseURL;
var ClientSecret;
var ClientToken;
var ReqType;
var ReqPath;
var Data;
// Pick up environment variables into credentials object
var credentials = {
@tdm00
tdm00 / example.js
Created August 9, 2013 13:36
Do the following in Chrome Developer Tools Console
datetime="2013-07-31T05:05Z"
var d = new Date(datetime);
d
/* returns Wed Jul 31 2013 01:05:00 GMT-0400 (EDT) */
@tdm00
tdm00 / gist:5485824
Created April 30, 2013 00:19
Rails is just Ruby fix
```ruby
module Beeper
def self.twilio_phone_number
'xyz'
end
def self.twilio_sid
'xxx'
end
def self.twilio_auth_token
'yyy'
@tdm00
tdm00 / Dev_Gemfile
Last active December 15, 2015 01:58
Group of gems that I use in development for Ruby on Rails. Paste this into your Gemfile and then run `bundle install`AAfter the gems are installed, you need to also run `rails generate rails_footnotes:install`
group :development do
gem 'brakeman'
gem 'better_errors'
gem 'binding_of_caller'
gem 'meta_request'
gem 'rack-mini-profiler'
gem 'rails-footnotes'
# run `rails generate rails_footnotes:install`
end
@tdm00
tdm00 / gist:5151726
Created March 13, 2013 12:44
gitlab logrotate config
# Place this file in /etc/logrotate.d/gitlab
/home/gitlab/gitlab/log/*.log {
daily
rotate 52
missingok
delaycompress
compress
copytruncate
}
article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio,canvas,video{display:inline-block;*display:inline;*zoom:1}audio:not([controls]){display:none}html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}a:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px;outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}a:hover,a:active{outline:0}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{max-width:100%;width:auto\9;height:auto;vertical-align:middle;border:0;-ms-interpolation-mode:bicubic}#map_canvas img,.google-maps img{max-width:none}button,input,select,textarea{margin:0;font-size:100%;vertical-align:middle}button,input{*overflow:visible;line-height:normal}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:b
@tdm00
tdm00 / Comment.rb
Created October 4, 2012 14:26
Dashboard of posts and comments
class Comment < ActiveRecord::Base
# Associations
belongs_to :post
belongs_to :commenter
end
@tdm00
tdm00 / patient.rb
Created October 1, 2012 22:22
Associations to deep?
class Patient < ActiveRecord::Base
# Associations
has_many :Requisitions
# Functions
def full_name
return [given_name, family_name].join(' ')
end
end
# Based on
# http://guides.rubyonrails.org/active_record_querying.html#eager-loading-multiple-associations
# This works
Post.includes(:category, :comments => [:user])
# This does not work
Post.includes(:comments => [:user], :category)