Skip to content

Instantly share code, notes, and snippets.

@robcthegeek
robcthegeek / conventional-comments.md
Last active October 25, 2024 10:57 — forked from pauloportella/conventional-comments.md
How to setup conventional comments on Github
@robcthegeek
robcthegeek / README.md
Last active June 27, 2016 16:17 — forked from anonymous/index.html
Azure Service Bus Correlation Presi
@robcthegeek
robcthegeek / ControllerExtensions.cs
Created November 21, 2012 11:41
Rendering Partial Views to Strings in ASP.NET MVC
using System.IO;
using System.Web.Mvc;
namespace Website.App.Extensions
{
public static class ControllerExtensions
{
public static string RenderPartialToString(this Controller controller, string partial, object model)
{
controller.ViewData.Model = model;
@robcthegeek
robcthegeek / clean-ow.sh
Created October 29, 2012 12:00
Clean Up OSX "Open With" Menu
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
@robcthegeek
robcthegeek / 1-email-validator.rb
Created January 21, 2012 23:41
Ruby Open Classes - Code Examples
class String
# taken from: http://regexlib.com/REDetails.aspx?regexp_id=2558 - (escaped the forward-slashes as well)
def is_email?
self =~ /^((([!#$\%&'*+\-\/=?^_`{|}~\w])|([!#$\%&'*+\-\/=?^_`{|}~\w][!#$\%&'*+\-\/=?^_`{|}~\.\w]{0,}[!#$\%&'*+\-\/=?^_`{|}~\w]))[@]\w+([-.]\w+)*\.\w+([-.]\w+)*)$/
end
def isnt_email?
!is_email?
end
end
@robcthegeek
robcthegeek / user.rb
Created November 9, 2011 21:32
"Standard" User Model Using Mongoid/BCrypt
require 'bcrypt'
class User
include Mongoid::Document
include Mongoid::Timestamps
include BCrypt
attr_accessor :password, :password_confirmation
attr_protected :password_hash
@robcthegeek
robcthegeek / great-escape.rb
Created September 28, 2011 22:34
So, URI.escape doesn't escape so well..
module URI
# For Times Where URI.escape should *ACTUALLY* Escape!
def self.great_escape(s)
URI.escape(s, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
end
end
/* http://meyerweb.com/eric/thoughts/2011/01/03/reset-revisited/
v2.0b1 | 201101
NOTE: WORK IN PROGRESS
USE WITH CAUTION AND TEST WITH ABANDON */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
@robcthegeek
robcthegeek / Output.txt
Created July 22, 2011 13:45
Stack - Demo LIFO - Thrown together in Snippet Compiler
In Third
In Second
In First
Press any key to continue...