Skip to content

Instantly share code, notes, and snippets.

View scottb's full-sized avatar

Scott Brickner scottb

  • The Brickner Group
  • Washington, DC
View GitHub Profile
@scottb
scottb / gist:175112
Created August 25, 2009 23:17
Reference the Google APIs easily
class GoogleApis
# compiled from http://code.google.com/apis/ajaxlibs/documentation/
LATEST_VERSIONS = {
:jsapi => 'http://www.google.com/jsapi',
:jquery => 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js',
:jqueryui => 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js',
:prototype => 'http://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js',
:scriptaculous => 'http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.3/scriptaculous.js',
:mootools => 'http://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools-yui-compressed.js',
:dojo => 'http://ajax.googleapis.com/ajax/libs/dojo/1.4.1/dojo/dojo.xd.js',
@scottb
scottb / app-assets-javascripts-application.js
Created September 7, 2011 15:48
Getting Dojo to work with Rails 3.1 and Sprockets
//= require_directory .
dojo.require('dojox.rails');
@scottb
scottb / line.rb
Created August 31, 2012 03:16 — forked from actsasgeek/line.rb
ruby implementation of gradient descent linear regression
require 'generator'
samples = [
{ :xs => [ 1.0, 0.25], :y => 0.98},
{ :xs => [ 1.0, 0.49], :y => 0.82},
{ :xs => [ 1.0, 0.60], :y => 0.41},
{ :xs => [ 1.0, 0.89], :y => 0.31}
]
# line is the sum of the dot product of the weight (thetas)
@scottb
scottb / adjustable.css
Created October 4, 2012 00:52
Rudimentary jQuery-based code to make "reactive documents", similar to http://worrydream.com/#!/Tangle
.adjustable { color: blue; border-bottom: dotted blue 1px; cursor: col-resize; }
.adjusting { -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }
@scottb
scottb / god.service
Created December 8, 2013 01:51
Fedora systemd service file for running god
[Unit]
Description=God: A process monitoring framework in Ruby
After=network.target
[Service]
ExecStart=/usr/local/rvm/bin/deploy_god -c /etc/god/god.conf -l /var/log/god/god.log -D
ExecStop=/usr/local/rvm/bin/deploy_god quit
[Install]
WantedBy=multi-user.target
@scottb
scottb / gist:43d5c67e2b90d5e918ba
Created March 6, 2015 19:57
Bootstrap3-styled file upload buttons
.btn-file {
position: relative;
overflow: hidden;
& input[type=file] {
position: absolute;
top: 0;
min-width: 100%;
max-width: 100%;
min-height: 100%;
@scottb
scottb / gist:d8ca4183c32467632f91
Last active August 29, 2015 14:16
Bootstrap3-styled progress tags (makes HTML5 progress tags look like Bootstrap3's div.progress
$progress-border-radius: $border-radius-base !default;
progress {
color: $progress-bar-bg;
background-size: auto;
width: 100%;
height: 20px;
box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.15);
border-radius: $progress-border-radius;
margin-bottom: 20px;
# --skip-turbolinks --skip-test --database=postresql
file '.editorconfig', <<-CODE
[*]
indent_style = space
indent_size = 2
tab_width = 8
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
@scottb
scottb / authorize_aws.rb
Last active February 25, 2019 19:32
Generate the necessary envariables to authenticate a shell window to AWS when an MFA token is in use
require 'aws-sdk'
duration = 24 * 60 * 60
creds = Aws::STS::Client.new.get_session_token(duration_seconds: duration, serial_number: ARGV[0], token_code: ARGV[1]).credentials
puts "export AWS_ACCESS_KEY_ID=#{creds.access_key_id}"
puts "export AWS_SECRET_ACCESS_KEY=#{creds.secret_access_key}"
puts "export AWS_SESSION_TOKEN=#{creds.session_token}"