This file contains 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
# Ruby 2.1.2 | |
2.1.2 :173 > x = BigDecimal.new(1.0, 1) | |
=> #<BigDecimal:7ffcee09bb98,'0.1E1',9(27)> | |
2.1.2 :174 > y = Marshal.load Marshal.dump x | |
=> #<BigDecimal:7ffcec5d9ee0,'0.1E1',9(18)> | |
2.1.2 :175 > x == y | |
=> true | |
2.1.2 :176 > Marshal.dump(x) == Marshal.dump(y) | |
=> false |
This file contains 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
# I used this to monitor changes to the .git folder during | |
# my Austin on Rails lightning talk on Understanding Git. | |
# | |
# I ignore any changes to the .git/logs folder, because they are | |
# noisy and don't add a lot to understanding. | |
# If you want "the whole truth", remove the :ignore parameter below. | |
# | |
# ruby listen.rb <path to .git folder> | |
# | |
# gem install listen # its the foundation of Guard |
This file contains 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
require 'test/unit' | |
require 'delegate' | |
# These tests demonstrate some unexpected (to me) | |
# behavior of a class created by DelegateClass. | |
# An instance of a DelegateClass created class does not eql? itself. | |
# | |
# The WidgetTests all pass. | |
# The comparison and eql WidgetWrapperTests fail. | |
# ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0] |
This file contains 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 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 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 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 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 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 | |
{ |
This file contains 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
BACKUP DATABASE MyDbName TO DISK = 'C:\MSSQL\Backup\mydbname_backup.bak' | |
RESTORE DATABASE MyDbName FROM DISK = 'C:\MSSQL\Backup\mydbname_backup.bak' WITH RECOVERY, REPLACE |