Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am rlmattax on github.
  • I am bobmattax (https://keybase.io/bobmattax) on keybase.
  • I have a public key ASCsq2K6QQDv4NuSTmmG1xwQukQcn5WvzIyn1VCxwmYcewo

To claim this, I am signing this object:

View gist:7251268
<script src="//code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script src="//code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script src="//beta.pactsafe.com/assets/pactsafe.js"></script>
<link href="//beta.pactsafe.com/assets/badge.css" media="screen" rel="stylesheet">
View gist:6500450
import sublime, sublime_plugin, os
class ExpandTabsOnSave(sublime_plugin.EventListener):
# Run ST's 'expand_tabs' command when saving a file
def on_pre_save(self, view):
if view.settings().get('expand_tabs_on_save') == 1:
view.window().run_command('expand_tabs')
@rlmattax
rlmattax / ActiveAdmin + Rolify -- Roles Administration
Created Aug 10, 2013
Active Admin + Rolify -- A simple example of modifying roles within active admin on users.
View ActiveAdmin + Rolify -- Roles Administration
ActiveAdmin.register User do
index do
column "ID" do |user|
link_to user.id, admin_user_path(user)
end
...
column :roles do |user|
user.roles.collect {|c| c.name.capitalize }.to_sentence
end
default_actions
@rlmattax
rlmattax / gist:4628713
Created Jan 24, 2013
Sendgrid Listener
View gist:4628713
class ListenerController < ApplicationController
skip_before_filter :verify_authenticity_token
def receive_email
@params = params
@inbound_email = InboundEmail.new(:text => params["text"],
:html => params["html"],
:to => clean_field(params["to"]),
:from => clean_field(params["from"]),
@rlmattax
rlmattax / gist:3962926
Created Oct 27, 2012
Active Admin User Impersonation
View gist:3962926
ActiveAdmin.register User do
menu :parent => "Users"
member_action :impersonate, :method => :get do
user = User.find(params[:id])
flash[:notice] = "Successfully logged in as : #{user.email} #{view_context.link_to('Be careful!', root_path)}".html_safe
begin
warden.set_user(resource,{:scope=>:user,:run_callbacks=>false})
rescue
flash[:error] = "Unable to log you in. Poop."
View gist:3084374
Options -MultiViews
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
# DEFAULT APP
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?req=$1 [L,QSA]
View gist:1628746
class BadUsernameMailer < ActionMailer::Base
layout 'mailer'
default from: "info@uflavor.com"
def username_changed_email(user,old,new)
@old = old
@new = new
mail(:to => user.email, :subject => "uFlavor - Important Account Information - username changed")
end
end
View gist:1345791
background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(0, rgba(255,255,255,0)), color-stop(0.15, rgba(255,255,255,0.55)), color-stop(0.5, rgba(255,255,255,0))), -webkit-gradient(linear, 0 0, 0 100%, color-stop(0, #204db5), color-stop(0.1, #0251ae), color-stop(0.9, #6fc1ff), color-stop(1, #569ce1));
-webkit-mask-image: -webkit-gradient(linear, 18 0, 0 10, color-stop(0.23, rgba(0,0,0,0)), color-stop(0.3, rgba(0,0,0,0.8)), color-stop(0.4, rgba(0,0,0,1)), color-stop(0.7, rgba(0,0,0,1)), color-stop(0.7, rgba(0,0,0,0.8)), color-stop(0.77, rgba(0,0,0,0)));
-webkit-mask-repeat: repeat-x;
-webkit-mask-size: 20px 15px;
-webkit-mask-position: 0px;
View gist:1310010
module ApplicationHelper
FLASH_TYPES = [:notice, :error ]
def flash_messages
res = ""
FLASH_TYPES.each do |type|
res += content_tag(:div, flash[type], :class=>[type,"notification", "rounded-corners"]) if flash[type]
end
raw(res)
end
end