Skip to content

Instantly share code, notes, and snippets.

@icantrap
icantrap / .autotest
Created July 27, 2010 08:47
Autotest init hook - rerun all on factory_girl factory change
Autotest.add_hook :initialize do |autotest|
autotest.add_mapping %r%^test/factories/.*\.rb$% do |filename, match_data|
autotest.files_matching %r%^test/(unit|controllers|views|functional)/.*_test\.rb$%
end
false
end
@icantrap
icantrap / .autotest
Created July 27, 2010 08:51
Autotest init hook - rerun all when new test db is created
Autotest.add_hook :initialize do |autotest|
# remove the exceptions added by autotest-rails, then readd them w/o test.sqlite3
autotest.remove_exception %r%^\./(?:db|doc|log|public|script|tmp|vendor)%
autotest.add_exception %r%^\./(?:doc|log|public|script|tmp|vendor)%
autotest.add_exception %r%^\./db/(?:migrate|(development\.sqlite3|.*\.rb)$)%
autotest.add_mapping %r%^db/test.sqlite3$% do |filename, match_data|
autotest.files_matching %r%^test/(unit|controllers|views|functional)/.*_test\.rb$%
end
@icantrap
icantrap / factory_girl attachments for paperclip
Created July 27, 2010 18:06 — forked from jeffrafter/factory_girl attachments for paperclip
Example of factory_girl factory for model that has paperclip attachment
require 'action_controller/test_process'
# Paperclip attachments in factories, made easy based on technicalpickles
Factory.class_eval do
def attach(name, path, content_type = nil)
if content_type
add_attribute name, ActionController::TestUploadedFile.new("#{RAILS_ROOT}/#{path}", content_type)
else
add_attribute name, ActionController::TestUploadedFile.new("#{RAILS_ROOT}/#{path}")
end
@icantrap
icantrap / failed.png
Created August 4, 2010 07:50 — forked from boxedup/tests.watchr
watchr script for non-Rails test::unit projects w/ growl support
�PNG

���
IHDR���@���@����iq���� pHYs�� �� ������IDATx�[�eE��O��ř7�!H�`�$+��*�%���J颈�KX]FKV��0n) ò�����$q� �̼y9�xR��u���� ����{}:�����>�:�� l���ey���2ϑ�3;3��9�4wI�sPE�C�����)H%�����8�$QH�J�f��t�S+�J=���^���p�:�'2�=5��O٢
��#����p������C�FM�޾��k?I�u7ܾM��[%ܵ����]�H��Y�" >E�iTM���A(�KĕXi��l訟%�}���օt���|S���w�|�鿯?��������. �UqS���-��7��N��4"il�,��0��-��Q5�$�Ҩ�4�Z��J�n�#��HG�;=�Le�v�ZAu�* �C�E���Z��7;z���o||e�$�q\ʮ�@�6(�蠭x���_�t���ScI !"m�L�&'��f�WI��0��x�P,�W��0����e�zyF?X�
J)�.r,&83\��;G~��g����H
�{��&��a�k&)K3��_/˾�}�<��T{D��a5���������l L�0�%. �Ւ��C#$A��R��v�4䓟��W����J�P����-���?�~� o~��+���{�c�+���k*�E�3���I�cP
$}o?E��t����4jA ��6c�OH��g^GH=E/.�y�N+�]
��� �Q�����������[�S�zE����g�`�:��X�L���H#��,=g�Kr�> j����Q�K�@bM��Sm�A�0��L�PFP\ϥ��?m��ߜ� �J�Y�Ʀϯ]���EE4j���L.��t��7Li/��D΁��>�$���_�S��u�}C�\��\up�b7_�I�f@�Z�����#f������ƄnI��i����������X��;߆ZBA�F�H�-+�'���[���~�zH���3a�I �]y��+
@icantrap
icantrap / git-proxy.sh
Created October 26, 2010 20:25
How to Github and Gitorious over HTTP proxy

You could always use Smart HTTP.

For read-only (git:) urls, install corkscrew.

  1. Download git-proxy.sh. Put it somewhere and make it executable.

  2. Run git config --global core.gitproxy '/usr/local/bin/git-proxy.sh'

To clone, push, pull over ssh, add the contents of ssh_config to your ~/.ssh/config file.

@icantrap
icantrap / reddit_android.css
Created November 18, 2010 02:03
Stylesheet to use Droid fonts on Reddit Android subreddit
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document url-prefix("http://www.reddit.com/r/Android/") {
body {
font: x-small Droid Sans,arial,sans-serif !important;
font-family: Droid Sans,arial,sans-serif !important;
}
}
/*
@icantrap
icantrap / gist:1469646
Created December 12, 2011 23:28 — forked from stesh/gist:1130885
Disable Dashboard on OS X
#!/bin/sh
defaults write com.apple.dashboard mcx-disabled -boolean YES
killall Dock
@icantrap
icantrap / index.html
Created December 14, 2011 18:15
Load jquery from Google CDN. Backup to hosted version, if CDN fails
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
if(typeof jQuery=="undefined"){
document.write(unescape("%3Cscript src='/js/jquery-1.7.1.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
@icantrap
icantrap / gist:1670394
Created January 24, 2012 14:19
Pin Dock (OS X)
# This pins the Dock to the right/bottom. Other valid values are start and middle.
defaults write com.apple.dock pinning -string "end"
killall Dock
@icantrap
icantrap / ssh-copy-id.sh
Last active December 19, 2015 06:09
What to do if there's no ssh-copy-id available
cat ~/.ssh/id_rsa.pub | ssh user@host 'cat >> ~/.ssh/authorized_keys'