This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SmartUrlHelper.configure do |url| | |
url.for ->model{ model.is_a?(Comment) } do |helpers, model| | |
helpers.post_comment_path(model.post, model) | |
end | |
# TODO: Add a convenience method for matching on type: | |
# url.for(Comment) do |helpers, model| | |
# helpers.post_comment_path(model.post, model) | |
# end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A small DSL for helping parsing documents using Nokogiri::XML::Reader. The | |
# XML Reader is a good way to move a cursor through a (large) XML document fast, | |
# but is not as cumbersome as writing a full SAX document handler. Read about | |
# it here: http://nokogiri.org/Nokogiri/XML/Reader.html | |
# | |
# Just pass the reader in this parser and specificy the nodes that you are interested | |
# in in a block. You can just parse every node or only look inside certain nodes. | |
# | |
# A small example: | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# copy blueutil from http://www.frederikseiffert.de/blueutil/ to ~/bin | |
# I created this as a Shell Extension in Alfred and assigned a global hotkey to it (Command+Ctrl-B) | |
if ~/bin/blueutil status|grep -q on; then ~/bin/blueutil off; else ~/bin/blueutil on;fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add to your ~/.gitconfig | |
[alias] | |
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.when( getTweets('austintexasgov'), | |
getTweets('greenling_com'), | |
getTweets('themomandpops') | |
).done(function(atxArgs, greenlingArgs, momandpopsArgs){ | |
var allTweets = [].concat(atxArgs[0]).concat(greenlingArgs[0]).concat(momandpopsArgs[0]); | |
var sortedTweets = sortTweets(allTweets); | |
showTweets(sortedTweets); | |
}); | |
var getTweets = function(user){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
SETLOCAL | |
REM This can be used for any .exe installed by a nuget package | |
REM Example usage: nuget_tool.bat nunit-console.exe myproject.tests.dll | |
SET TOOL=%1 | |
FOR /R %~dp0\source\packages %%G IN (%TOOL%) DO ( | |
IF EXIST %%G ( | |
SET TOOLPATH=%%G | |
GOTO FOUND | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc "Downloads from CI and pushes nuget packages to the official feed" | |
task :release, [:package] do |t, args| | |
require 'open-uri' | |
release_path = "#{buildsupport_path}/nuget_release" | |
clean_dir release_path | |
# The @teamcity_build_id is a unique identifier for the build configuration (looks like "bt234"). You can usually figure it out from your project url | |
artifact_url = "http://teamcity.codebetter.com/guestAuth/repository/downloadAll/#{@teamcity_build_id}/.lastSuccessful/artifacts.zip" | |
puts "downloading artifacts from teamcity.codebetter.com" | |
artifact = open(artifact_url) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
SETLOCAL | |
SET VERSION=%1 | |
SET NUGET=buildsupport\nuget.exe | |
FOR %%G IN (packaging\nuget\*.nuspec) DO ( | |
%NUGET% pack %%G -Version %VERSION% -Symbols -o artifacts | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Assumes Resharper IntelliJ/IDEA Resharper keybindings | |
Create a new ASP.NET MVC Web application (Internet) | |
Open HomeController.cs and start typing outside of HomeController, but within the namespace: | |
cl[Tab]WorkController[Enter] | |
p[Tab]Ac[Tab]Show(){[Enter] | |
return _workflowService.GetResult();[Enter] | |
*position cursor on _workflowService |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class SystemClock | |
{ | |
static SystemClock() | |
{ | |
Live(); | |
} | |
public static DateTime Now | |
{ |