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
| require "yaml" | |
| class ::Hash | |
| # From activeressource | |
| def deep_merge(other_hash) | |
| self.merge(other_hash) do |key, oldval, newval| | |
| oldval = oldval.to_hash if oldval.respond_to?(:to_hash) | |
| newval = newval.to_hash if newval.respond_to?(:to_hash) | |
| oldval.class.to_s == 'Hash' && newval.class.to_s == 'Hash' ? oldval.deep_merge(newval) : newval | |
| 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
| class BankAccountController | |
| def admin_index | |
| @bbans = Bbans.all | |
| end | |
| def user_index | |
| @bbans_user = current_user.bbans.all | |
| 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
| Content for .zsh: | |
| ######### | |
| # COLORS | |
| ######### | |
| autoload -U colors | |
| colors | |
| setopt prompt_subst |
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
| export CC=/usr/bin/gcc-4.2 |
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
| http://www.facebook.com/dialog/pagetab?app_id=[APP_ID]&redirect_uri=http://[REDIRECT_URL] | |
| This URL might vary. At the time of creating this gist (April 2012), it is working fine. | |
| If the URL changed, please comment and let me know |
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
| # If your workers are inactive for a long period of time, they'll lose | |
| # their MySQL connection. | |
| # | |
| # This hack ensures we re-connect whenever a connection is | |
| # lost. Because, really. why not? | |
| # | |
| # Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar) | |
| # | |
| # From: | |
| # http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/ |
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
| console.log("hey") | |
| => ReferenceError: console is not defined | |
| console?.log("hey") | |
| => nothing |
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
| require 'logger' | |
| if ENV.include?('RAILS_ENV') && !Object.const_defined?('RAILS_DEFAULT_LOGGER') | |
| # log SQL to the Rails console | |
| Object.const_set('RAILS_DEFAULT_LOGGER', Logger.new(STDOUT)) | |
| 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
| javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; var DI= document.getElementsByTagName("img"); DIL=DI.length; function A(){for(i=0; i<DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=Math.sin(R*x1+i*x2+x3)*x4+x5+"px"; DIS.top=Math.cos(R*y1+i*y2+y3)*y4+y5+"px"}R++}tag=setInterval('A()',5 );document.onmousedown=function(){clearInterval(tag);for(i=0; i<DIL; i++){DI[i].style.position="static";}}; void(0) |
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
| # Matches patterns such as: | |
| # https://www.facebook.com/my_page_id => my_page_id | |
| # http://www.facebook.com/my_page_id => my_page_id | |
| # http://www.facebook.com/#!/my_page_id => my_page_id | |
| # http://www.facebook.com/pages/Paris-France/Vanity-Url/123456?v=app_555 => 123456 | |
| # http://www.facebook.com/pages/Vanity-Url/45678 => 45678 | |
| # http://www.facebook.com/#!/page_with_1_number => page_with_1_number | |
| # http://www.facebook.com/bounce_page#!/pages/Vanity-Url/45678 => 45678 | |
| # http://www.facebook.com/bounce_page#!/my_page_id?v=app_166292090072334 => my_page_id | |
| # http://www.facebook.com/my.page.is.great => my.page.is.great |