Skip to content

Instantly share code, notes, and snippets.

View remino's full-sized avatar

Rem remino

View GitHub Profile
@mattlenz
mattlenz / markdown_handler.rb
Created July 27, 2012 01:03
Rails Markdown (Kramdown) Template Handler
# config/initializers/markdown_handler.rb
module MarkdownHandler
def self.erb
@erb ||= ActionView::Template.registered_template_handler(:erb)
end
def self.call(template)
compiled_source = erb.call(template)
"Kramdown::Document.new(begin;#{compiled_source};end, auto_ids: false).to_html"
@jason
jason / gist:3090943
Created July 11, 2012 14:56
Not loading form_for inside of rails console? Also might be reason why my test is failing
➜ sample_app git:(sign-up) ✗ rails c
Loading development environment (Rails 3.2.6)
irb(main):001:0> require "capybara/rails"
=> true
irb(main):002:0> include Capybara::DSL
=> Object
irb(main):003:0> include Rails.application.routes.url_helpers
=> Object
irb(main):005:0> visit signup_path
=> nil
@jessedearing
jessedearing / gist:2351836
Created April 10, 2012 14:44 — forked from twoism-dev/gist:1183437
Create self-signed SSL certificate for Nginx
#!/bin/bash
echo "Generating an SSL private key to sign your certificate..."
openssl genrsa -des3 -out myssl.key 1024
echo "Generating a Certificate Signing Request..."
openssl req -new -key myssl.key -out myssl.csr
echo "Removing passphrase from key (for nginx)..."
cp myssl.key myssl.key.org
openssl rsa -in myssl.key.org -out myssl.key
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
@bhollis
bhollis / .htaccess
Created March 25, 2012 22:58
Serving pre-gzipped assets from Apache
AddEncoding gzip .gz
RewriteEngine on
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{HTTP_USER_AGENT} !Konqueror
RewriteCond %{REQUEST_FILENAME}.gz -f
RewriteRule ^(.*)\.css$ $1.css.gz [QSA,L]
RewriteRule ^(.*)\.js$ $1.js.gz [QSA,L]
RewriteRule ^(.*)\.html$ $1.html.gz [QSA,L]
@jswartwood
jswartwood / Run in LOCAL terminal...
Created February 19, 2012 01:53
Automatic Git deploys on Dreamhost
# Replace any brackets with real values
# Try to ssh in to DREAMHOST (ensure it no longer asks for a PW); you may want to restart Terminal
ssh [user]@[host]
cd ~
mkdir [mydomain_com].git
cd [mydomain_com].git
git init --bare
vi hooks/post-receive
# Enter the code from the "post-receive" file (in this gist); save + quit
@scottwb
scottwb / application_controller.rb
Created February 17, 2012 06:12
Get a list of all the filters on a given Rails 3 controller.
# Add these methods to your ApplicationController. Then, any controller
# that inherits from it will have these methods and can programmatically
# determine what filters it has set.
class ApplicationController < ActionController::Base
def self.filters(kind = nil)
all_filters = _process_action_callbacks
all_filters = all_filters.select{|f| f.kind == kind} if kind
all_filters.map(&:filter)
end
@joelverhagen
joelverhagen / README.md
Created February 12, 2012 02:14
Jekyll YouTube Embed Plugin

This is a plugin meant for Jekyll.

Example use:

Easily embed a YouTube video. Just drop this file in your _plugins directory.

{% youtube oHg5SJYRHA0 %}
@lavallee
lavallee / screen.rb
Created December 2, 2011 17:51
Homebrew Formula for screen 4.0.3 that has vertical split and works on Snow Leopard
require 'formula'
# This duplicates the system "screen", but fixes the ability
# to use vertical splits.
class Screen < Formula
url 'http://ftpmirror.gnu.org/screen/screen-4.0.3.tar.gz'
homepage 'http://www.gnu.org/software/screen'
md5 '8506fd205028a96c741e4037de6e3c42'
version '4.00.03'
@jamesaoverton
jamesaoverton / slim_converter.rb
Created October 25, 2011 19:45
Slim converter for Jekyll.
module Jekyll
require 'slim'
Slim::Engine.set_default_options :pretty => true
class SlimConverter < Converter
safe true
priority :low
def matches(ext)
ext =~ /slim/i