I hereby claim:
- I am craigmartin on github.
- I am craigmartin (https://keybase.io/craigmartin) on keybase.
- I have a public key ASAdinWSTtGU3CfTn3yrihtJuu-pc_wPjWWM_0Rgerlgigo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| # Find the IAM username belonging to the TARGET_ACCESS_KEY | |
| # Useful for finding IAM user corresponding to a compromised AWS credential | |
| # Requirements: | |
| # | |
| # Environmental variables: | |
| # AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY | |
| # python: | |
| # boto |
| #!/bin/sh | |
| # | |
| ### BEGIN INIT INFO | |
| # Provides: play app | |
| # Required-Start: $local_fs $remote_fs $network $syslog | |
| # Required-Stop: $local_fs $remote_fs $network $syslog | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: play web application | |
| # Description: Controls web application written with Play! framework |
| List of steps I take to upgrade an app from Rails 2.3 to 3.2 (generically speaking with many assumptions) | |
| Step 1 - Add Bundler and a Gemfile to existing Rails 2.3 application. | |
| - by-product = clean up gems being used. | |
| Step 2 - | |
This gist is a fork of the gist from this blog post.
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <style>p { background:yellow; margin:6px 0; } p.off { background: black; }</style> | |
| <script src="http://code.jquery.com/jquery-latest.js"></script> | |
| <script src="validateLinks.js" type="text/javascript"></script> | |
| <script type="text/javascript"> | |
| $().ready(function() { | |
| $('#links').validateLinks( { | |
| }); |
| require 'rubygems' | |
| gem 'rest-client', '=1.6.1' | |
| %w(./config haml sinatra digest/md5 rack-flash json rest-client ./models).each { |lib| require lib} | |
| set :sessions, true | |
| set :show_exceptions, false | |
| set :environment, :development | |
| use Rack::Flash | |
| get "/" do | |
| if session[:userid].nil? then |
| %w(dm-core dm-timestamps dm-validations dm-aggregates).each {|lib| gem lib, '=1.0.2'} | |
| %w(dm-core dm-timestamps dm-validations dm-aggregates dm-migrate RMagick aws config).each { |lib| require lib} | |
| include Magick | |
| DataMapper.setup(:default, ENV['DATABASE_URL'] || 'mysql://root:fa1556cm@localhost/monsoc') | |
| S3 = Aws::S3Interface.new(S3_CONFIG['AWS_ACCESS_KEY'], S3_CONFIG['AWS_SECRET_KEY'], {:multi_thread => true, :protocol => 'http', :port => 80} ) | |
| module Commentable | |
| def people_who_likes | |
| self.likes.collect { |l| "<a href='/user/#{l.user.nickname}'>#{l.user.formatted_name}</a>" } |
| (function($) { | |
| $.fn.validateLinks = function(options) { | |
| var defaults = { | |
| length: 300, | |
| minTrail: 20, | |
| moreText: "more", | |
| lessText: "less", | |
| ellipsisText: "..." | |
| }; |
| class HomeController < ApplicationController | |
| # use code block as filter | |
| before_filter do |controller| | |
| controller.send(:intruder?) # call intruder? method in the controller | |
| # ... | |
| end | |
| def intruder? | |
| # ... | |
| end |