Skip to content

Instantly share code, notes, and snippets.

Avatar

Paul dagda1

View GitHub Profile
View gist:860016
require 'test_helper'
require 'fake_web'
class LeadControllerTest < ActionController::TestCase
context "given a valid url to preform a search" do
setup do
FakeWeb.register_uri(:any, "http://thesoftwaresimpleton.blogspot.com/", :body => "sample.html")
login_as_standard_user
View mayhem.cs
protected ViewResult SaveItemWithParent<T, U>(string structureName, Guid? uid, Guid? parentUid, string parentStructureType,
Func<Guid, T> loadItem, Action<T, Guid> setParent, Func<ViewResult> all, string structureType)
where T : StructureBase, IParent<U>, new()
where U : StructureBase, new()
View uniqueresult.cs
public virtual T GetByExpression<T>(Expression<Func<T, bool>> expression) where T : class
{
var session = _sessionManager.OpenSession();
var result = session.QueryOver<T>()
.Where(expression)
.List()
.FirstOrDefault();
return result;
View kill_connections.sql
USE [master]
DECLARE @DatabaseName nvarchar(50)
SET @DatabaseName = N'ncontinuity2'
DECLARE @SQL varchar(max)
SET @SQL = ''
SELECT @SQL = @SQL + 'Kill ' + Convert(varchar, SPId) + ';'
FROM MASTER..SysProcesses
WHERE DBId = DB_ID(@DatabaseName) AND SPId <> @@SPId
View gist:897881
Host git.github.com
User git
IdentityFile ~/.ssh/id_rsa
Host git.assembla.com
User git
IdentityFile ~/.ssh/id_rsa_assembla
View gitconfig
[user]
email = paul.cowan@continuity2.com
name = paul.cowan
[core]
autocrlf = false
[merge]
tool = tortoisemerge
[mergetool "tortoisemerge"]
cmd = C:/Program Files/TortoiseGit/bin/TortoiseMerge.exe -base:$BASE -mine:$LOCAL -theirs:$REMOTE -merged:$MERGED
View Microsoft.PowerShell_profile.ps1
$snapins = Get-PSSnapin -Registered
$snapins | Add-PSSnapin
Get-Module -ListAvailable | Import-Module
Get-PSSnapin | Format-Table -autosize PSVersion, Name
Get-Module | Format-Table -autosize ModuleType, Name
function ff ([string] $glob) { get-childitem -recurse -include $glob }
@dagda1
dagda1 / gist:1053719
Created Jun 29, 2011
rails_js_template.rb
View gist:1053719
<%
dir = Rails.root.join('public/javascripts/app/templates/')
Dir["#{dir}**/*.*"].each do |path|
%>
<%
template = File.read(path)
name = path.gsub(dir.to_s, '').sub(File.extname(path), '')
%>
<script name="<%= name %>" type="text/x-js-template"><%= template.html_safe %></script>
<% end %>
@dagda1
dagda1 / gist:1053720
Created Jun 29, 2011
loadtemplates.js
View gist:1053720
loadTemplates: function() {
var templates = {};
$('*[type="text/x-js-template"]').map(function() {
var name = $(this).attr('name');
var source = $(this).html().replace('&gt;', '>');
if(name.split('/')[1][0] == '_') { Handlebars.registerPartial(name.replace('/', ''), source) }
templates[name] = Handlebars.compile(source);
});
return templates;
},
@dagda1
dagda1 / gist:1056202
Created Jun 30, 2011
observations.coffeescript
View gist:1056202
class Observation extends Backbone.Model
class Observations extends Backbone.Collection
model: Observation
class ObservationsView extends Backbone.View
el: $('#observations')
constructor: ->
@url = _observationsUrl
You can’t perform that action at this time.