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
| >> Integer('1001') | |
| => 1001 | |
| >> Integer('1001a') | |
| ArgumentError: invalid value for Integer: "1001a" | |
| from (irb):26:in `Integer' | |
| from (irb):26 | |
| #note this is very odd, so is '10a100'.to_i | |
| >> '1001a'.to_i | |
| => 1001 | |
| >> Float('1001.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
| /** | |
| * <p>Title: </p> | |
| * <p>Description: </p> | |
| * <p>Copyright: Copyright (c) 2004</p> | |
| * <p>Company: </p> | |
| * @author not attributable | |
| * @version 1.0 | |
| */ | |
| public class Room { |
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 File.dirname(__FILE__) + '/../test_helper' | |
| class FakeTest < ActiveSupport::TestCase | |
| test "first de" do | |
| puts "about to be de: #{I18n.locale}" | |
| assert_equal 'en', "#{I18n.locale}" | |
| I18n.locale = 'de' | |
| assert true | |
| 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
| Dir.glob("./mayerdan.com/**/*.php") do |local_filename| | |
| unless local_filename.to_s.match(/ayerdan\.com\/pics/) || | |
| local_filename.to_s.match(/wastedbrains\.com\/art\/index\.php/) || | |
| local_filename.to_s.match(/simplepie\/demo/) || | |
| local_filename.to_s.match(/proj\/picts\/slideshow\.php/) || | |
| local_filename.to_s.match(/prog\/bencode\/slideshow\.php/) || | |
| local_filename.to_s.match(/proj\/phpquiz/) || | |
| local_filename.to_s.match(/picts\/linpha-1\.0beta3\/adodb/) | |
| doc = File.read(local_filename) |
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
| rm -f mayerdan.com/.htaccess | |
| rm -f mayerdan.com/MT/.htaccess | |
| rm -f melonandorange.com/.htaccess | |
| rm -f melonandorange.com/dom/.htaccess | |
| rm -f melonandorange.com/nicole/.htaccess | |
| rm -f MYMOVETOLA.COM/.htaccess | |
| rm -f scoreher.com/.htaccess | |
| rm -f wastedbrains.com/.htaccess | |
| rm -f .htaccess | |
| rm -rf backup/mayerdan.com/tmp_1637643485416709.php |
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
| #!/usr/bin/env ruby | |
| # example usage: init_gemset mygemset | |
| # to use this setup an alias in your .bash_profile | |
| # | |
| # #setup new gemset | |
| # function initgemset() | |
| # { | |
| # local myresult=`ruby /Users/danmayer/projects/script_helpers/init_gemset.rb $#1` | |
| # eval "$myresult" |
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
| # this is rails 2.3.x so perhaps it has been fixed but any on a empty AR association object that has [] returns true. | |
| # after being inspected or to_s it returns false (as it should | |
| # rails console | |
| [].any? => false | |
| none = ar_object.association_objects (like Person.find(2).posts where there are no posts) => [] | |
| none.any? => false | |
| none.ancestors.map(&:to_s).sort == (from Rails.development.log none.ancestors.map(&:to_s).sort ) => true | |
| (just to make sure all the same things are loaded -> "ActiveRecord::AssociationPreload", "ActiveRecord::Associations", "ActiveRecord::AttributeMethods"... and many more) |
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 'net/http' | |
| require 'uri' | |
| COMPRESS_LEVEL = "SIMPLE_OPTIMIZATIONS" | |
| FILE_PATH = "assets/www/" | |
| FILES = ['application','custom','plugin','base'] | |
| def compress(compilation_level,jscode) | |
| response = Net::HTTP.post_form(URI.parse('http://closure-compiler.appspot.com/compile'), { | |
| 'js_code' => jscode, |
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
| #connect resque web to different redis server | |
| `resque-web ./resque-conn.rb` | |
| #cat ./resque-conn.rb => | |
| Resque.redis = Redis.new(:host => “127.0.0.1”, :port => 6379, :db => 1) |
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
| ;; move buffer to other window | |
| ;; after c-x 3 to split screen this lets you move buffers between sides. | |
| ;; altered code from: | |
| ;; http://stackoverflow.com/questions/1774832/how-to-swap-the-buffers-in-2-windows-emacs | |
| (defun swap-buffer-window () | |
| "Put the buffer from the selected window in next window, and vice versa" | |
| (interactive) | |
| (let* ((this (selected-window)) | |
| (other (next-window)) | |
| (this-buffer (window-buffer this))) |