Skip to content

Instantly share code, notes, and snippets.

View carlweis's full-sized avatar

Carl Weis carlweis

View GitHub Profile
@carlweis
carlweis / modal.html.slim
Created March 9, 2017 19:27
Bootstrap slim modal
/! Modal
#myModal.modal.fade aria-labelledby="myModalLabel" role="dialog" tabindex="-1"
.modal-dialog role="document"
.modal-content
.modal-header
button.close aria-label="Close" data-dismiss="modal" type="button"
span aria-hidden="true" ×
h4#myModalLabel.modal-title Modal title
.modal-body
| \...
@carlweis
carlweis / modal.html.slim
Created March 9, 2017 19:27
Bootstrap slim modal
/! Modal
#myModal.modal.fade aria-labelledby="myModalLabel" role="dialog" tabindex="-1"
.modal-dialog role="document"
.modal-content
.modal-header
button.close aria-label="Close" data-dismiss="modal" type="button"
span aria-hidden="true" ×
h4#myModalLabel.modal-title Modal title
.modal-body
| \...
@carlweis
carlweis / .pryrc
Created March 14, 2017 19:07
Custom Environment Consoles
# .pryrc
color_escape_codes = {
black: "\033[0;30m",
red: "\033[0;31m",
green: "\033[0;32m",
yellow: "\033[0;33m",
blue: "\033[0;34m",
purple: "\033[0;35m",
cyan: "\033[0;36m",
reset: "\033[0;0m"
@carlweis
carlweis / ghosting.rb
Last active May 1, 2017 21:54
Ghosting as a user
# config/routes.rb
resource :ghost, only: [:create, :destroy]
# app/controllers/ghosts_controller.rb
class GhostsController < ApplicationController
def create
session[:admin_id] = current_user.id
user = User.find(params[:user_id])
sign_in user
body {
background-color: #fff;
color: #333;
margin: 33px;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
}
p, ol, ul, td {
@carlweis
carlweis / vimrc
Created July 27, 2017 02:19 — forked from r00k/vimrc
A minimal vimrc for beginners
" A minimal vimrc for new vim users to start with.
"
" Referenced here: http://www.benorenstein.com/blog/your-first-vimrc-should-be-nearly-empty/
" Original Author: Bram Moolenaar <[email protected]>
" Made more minimal by: Ben Orenstein
" Last change: 2012 Jan 20
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
@carlweis
carlweis / soft_deletable.rb
Last active June 16, 2023 21:33
Allows soft deletes of an active record model
module SoftDeletable
extend ActiveSupport::Concern
included do
default_scope { where(deleted_at: nil) }
scope :deleted, -> { unscope(where: :deleted_at).where.not(deleted_at: nil) }
end
def delete
self.touch(:deleted_at) if has_attribute? :deleted_at
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Hello, world!</title>
</head>
<body>
@carlweis
carlweis / slack-black.css
Created December 4, 2018 17:27
Dark theme for Slack
body { background: #222; color: #e6e6e6; }
a { color: #949494; }
a:link, a:visited { color: #949494; }
a:hover, a:active, a:focus { color: #c7c7c7; }
hr { border-bottom: 1px solid #424242; border-top: 1px solid #222; }
let systemIcons = [
"circle",
"square",
"arrow.left",
"arrow.up",
"arrow.right",
"arrow.down",
"arrow.left.and.right",
"arrow.up.left",
"arrow.up.right",