Skip to content

Instantly share code, notes, and snippets.

# .gitignore for .NET projects
# Thanks to Derick Bailey
# http://www.lostechies.com/blogs/derickbailey/archive/2009/05/18/a-net-c-developer-s-gitignore-file.aspx
# Additional Thanks to
# - Alexey Abramov
# Standard VS.NET and ReSharper Foo
obj
bin
*.csproj.user
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@ryanb
ryanb / application.html.erb
Created January 19, 2011 19:31
Example of very simple password authentication.
<!-- layout file -->
<% if current_user %>
Welcome <%= current_user.username %>. Not you? <%= link_to "Log out", logout_path %>
<% else %>
<%= link_to "Sign up", signup_path %> or <%= link_to "log in", login_path %>.
<% end %>
@chyld
chyld / Installation of Ruby 1.9.2, Rails 3, MongoDB 1.6.5 on Ubuntu 10.10 64 bit Amazon EC2 image
Created February 3, 2011 23:08
Install Ruby, Rails, MongoDB on Amazon EC2 Ubuntu image with Sample Applicaton
#amazon ec2 image
#ubuntu 10.10, 64bit : ami-cef405a7
#to add additional ebs storage to your instance
#goto volumes and create a volume in the same zone as the instance
#after it is created, attach the volume to the instance
Attachment Information:i-dbb12eb7:/dev/sdp (attached)
#ssh to ec2
ssh -i <key-file>.pem ubuntu@<ip-address-to-ec2>
@stevenharman
stevenharman / fitter-happier.sh
Created March 12, 2011 03:20
awesomely weird; Radiohead uses OS X?
say -v Fred "Fitter, happier, more productive,
comfortable,
not drinking too much,
regular exercise at the gym
(3 days a week),
getting on better with your associate employee contemporaries,
at ease,
eating well
(no more microwave dinners and saturated fats),
a patient better driver,
@coreyhaines
coreyhaines / Generate UID
Created March 16, 2011 16:04
Use base32 encoding
to_encode = (rand(4096)+2048)*Time.new.to_i*<put a big number here, potentially secret, probably can figure it out easily enough>
Base32::Crockford.encode(to_encode, :split => 5)
def friendly_name(user)
temp_name = if user.first_name.blank? && user.last_name.blank?
user.email
elsif user.first_name.blank?
user.last_name
elsif user.last_name.blank?
user.first_name
else
"#{user.first_name} #{user.last_name}"
@napcs
napcs / README.md
Created May 6, 2011 04:10
Deploying Rails to Linode

Deploying Rails to Linode

Installing Ruby Enterprise Edition, Apache, MySQL, and Passenger for deploying Rails 3.0 applications.

Get a Linode, and set it up with Ubuntu 10.04 LTS so that you have till April 2013 to get updates. Once the Linode is formatted, boot it and continue on.

Set up an 'A' record in your DNS, pointing to the IP of your Linode. I'm using demo.napcs.com here.

Initial setup

@aaronlerch
aaronlerch / fluentmigrator_migration.xml
Created January 17, 2012 15:41
Simple Resharper live template for FluentMigrator migrations
<TemplatesExport family="Live Templates">
<Template uid="23818653-ac72-4057-9afc-35649cdfe0fc" shortcut="migration" description="FluentMigrator Migration" text="[Migration($VERSION$)]&#xD;&#xA;public class $MIGRATION_NAME$ : Migration&#xD;&#xA;{&#xD;&#xA; public override void Up()&#xD;&#xA; {&#xD;&#xA; $UP$&#xD;&#xA; }&#xD;&#xA;&#xD;&#xA; public override void Down()&#xD;&#xA; {&#xD;&#xA; $DOWN$&#xD;&#xA; }&#xD;&#xA;}" reformat="True" shortenQualifiedReferences="True">
<Context>
<CSharpContext context="Everywhere" minimumLanguageVersion="2.0" />
</Context>
<Categories />
<Variables>
<Variable name="VERSION" expression="getCurrentTime(&quot;yyyyMMddHHmmss&quot;)" initialRange="0" />
<Variable name="MIGRATION_NAME" expression="" initialRange="0" />
<Variable name="UP" expression="constant(&quot;throw new NotImplementedException();&quot;)" initialRange="0" />
#requires -version 2.0
[CmdletBinding()]
param (
[parameter(Mandatory=$true)]
[ValidatePattern('\.rptproj$')]
[ValidateScript({ Test-Path -PathType Leaf -Path $_ })]
[string]
$Path,
[parameter(