Skip to content

Instantly share code, notes, and snippets.

@robcthegeek
robcthegeek / Aliases.sh
Created June 7, 2010 09:35
Handy Git Commands for Quick Reference
# Edit Global .gitconfig, Adding/Updating the Following Section
[alias]
s = status -su
d = difftool
c = commit -am
co = checkout
l = log --pretty=oneline -20
log-del = log --diff-filter=D --
b = branch
@robcthegeek
robcthegeek / Backup and Restore.sh
Created August 13, 2010 23:57
Ubuntu & Rails Bits
# Big Thanks to : http://ubuntuforums.org/showthread.php?t=35087
# If you don't fancy the script - check out http://clonezilla.org
##### Backing Up #####
# Dead Easy Since Ubuntu Doesn't Lock Anything!
# Get Sudo and Browse to Root
sudo su
cd /
@robcthegeek
robcthegeek / DDD-Style Cache Wrapper.cs
Created November 1, 2010 10:01
DDD Style Repository Implementation (Cache Wrapper)
public interface ICustomerRepository
{
Customer RetrieveById(string id);
}
public class CustomerSessionCacheRepository(ICustomerRepository innerRepository) : ICustomerRepository
{
public Customer RetrieveById(string id)
{
if (_cache.Contains(id))
using System;
using System.Globalization;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Web.Mvc;
namespace Extensions
{
public static class HtmlHelperExtensions
@robcthegeek
robcthegeek / Install Rails 3.sh
Created December 5, 2010 19:05
Installation Instructions for Rails 3 on Ubuntu 10.10
# Build Checklist (http://ruby.about.com/od/rubyversionmanager/ss/installrvmlinux_2.htm)
$ sudo apt-get install build-essential
$ sudo apt-get install curl
$ sudo apt-get install zlib1g-dev libreadline5-dev libssl-dev libxml2-dev libopenssl-ruby
# Install Distro Version of Ruby (Since RVM Is Written in Ruby)
$ sudo apt-get install ruby1.8 rubygems1.8
# First Install RVM (http://rvm.beginrescueend.com/)
$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
@robcthegeek
robcthegeek / README.md
Created January 29, 2011 06:00
Dynamic JSON Objects and HTML Binding

Dynamic JavaScript Objects and HTML Binding

Problem: We are receiving JavaScript objects back from a web server which contain arbitrary data. This includes a hash of DynamicData which is used to hydrate some HTML. The HTML is based on partials that are stored on the server and bound to the JavaScript objects by a unique Widget ID.

<!--
From: http://toostep.com/trends/iis-7-change-concurrunt-connection-limit-in-iis7-for-maximum
Open: %windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet.config
-->
<system.web>
<applicationPool
maxConcurrentRequestsPerCPU="5000"
maxConcurrentThreadsPerCPU="2"
@robcthegeek
robcthegeek / pita-singletons.cs
Created May 24, 2011 16:52
Dealing with PITA Singletons that aren't thread safe.
public class MyService
{
private Func<IDep1> Dep1Factory;
private Func<IDep2> Dep2Factory;
IDep1 Dep1 { get { return Dep1Factory(); } }
IDep2 Dep2 { get { return Dep2Factory(); } }
public MyService()
{
@robcthegeek
robcthegeek / gembag.rb
Created July 17, 2011 17:23
Must-Have Gems
# Some gems I can't seem to live without :)
# Run this bad boy with: "ruby < <(curl https://raw.github.com/gist/1087827/gembag.rb)"
gems = %w{
rails
bundler
haml
json
heroku
faker
autotest