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
| begin | |
| loop do | |
| puts "in loop" | |
| if o = IO.select([input, ssl_socket].compact, nil, nil, activity_timeout) | |
| puts "in select if" | |
| if (input && (o.first.first == input)) | |
| puts "in if" | |
| data = input.readpartial(10000) | |
| puts "read partial" | |
| ssl_socket.write(data) |
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
| DROP VIEW IF EXIXTS student_views; | |
| CREATE VIEW student_views AS | |
| SELECT | |
| students.id AS id, | |
| students.name AS name, | |
| teachers.name AS teacher_name, | |
| schools.name AS school_name, | |
| countries.name AS country_name | |
| FROM students | |
| LEFT JOIN teachers ON teachers.id = students.teacher_id |
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 "Drop and create all views" | |
| task 'db:reload_views' => :environment do | |
| ActiveRecord::Migration.verbose = false | |
| Logger.new(STDOUT).debug('Rebuilding Views...') | |
| ActiveRecord::Migrator.down('db/views/') | |
| ActiveRecord::Migrator.up('db/views/') | |
| ActiveRecord::Migration.verbose = true | |
| end | |
| Rake::Task['db:migrate'].enhance do |
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
| count = 90 | |
| total = 100 | |
| %w(red amber green).map.with_index do |color, index| | |
| color if ((index + 1)/ 3.0) > (count.to_f / total.to_f) | |
| end.compact.first |
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
| su postgres -c "/opt/local/lib/postgresql84/bin/pg_ctl -D ${POSTGRESQL84DATA:=/opt/local/var/db/postgresql84/defaultdb} start -l /opt/local/var/log/postgresql84/postgres.log" |
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
| search = 80 | |
| hash = {1 => 83, 2 => 174, 3 => 276, 4 => 388, 5 => 512} | |
| hash.values.min do |a,b| | |
| (a - search).abs <=> (b - search).abs | |
| 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
| g++ -L/Users/tel/code/rubinius/vm/external_libs/llvm/Release/lib -lpthread -lffi -lm -o vm/vm vm/external_libs/libptr_array/libptr_array.a vm/external_libs/libcchash/libcchash.a vm/external_libs/libmquark/libmquark.a vm/external_libs/libtommath/libtommath.a vm/external_libs/libbstring/libbstring.a vm/external_libs/libgdtoa/libgdtoa.a vm/external_libs/onig/.libs/libonig.a vm/external_libs/libffi/.libs/libffi.a vm/external_libs/libltdl/.libs/libltdl.a vm/external_libs/libev/.libs/libev.a vm/assembler/libudis86.a vm/agent.o vm/ar.o vm/arguments.o vm/call_frame.o vm/compiled_file.o vm/config_parser.o vm/dispatch.o vm/environment.o vm/event.o vm/exception.o vm/exception_point.o vm/ffi.o vm/ffi_util.o vm/global_cache.o vm/global_lock.o vm/helpers.o vm/inline_cache.o vm/instructions.o vm/linkedlist.o vm/marshal.o vm/native_libraries.o vm/native_thread.o vm/objectmemory.o vm/ontology.o vm/oop.o vm/primitives.o vm/shared_state.o vm/signal.o vm/stack_variables.o vm/symboltable.o vm/thread_state.o vm/type_info.o vm/vir |
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
| def build_message | |
| message = PORTFOLIO_FIELDS.graph{|field, _| [field, send(field)] } | |
| self.message = message.delete_if { |_, value| value.nil? } | |
| 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
| #!/usr/bin/env ruby | |
| `ps | grep /spork$ | grep -v grep` | |
| if $?.success? | |
| exec('autospec') | |
| else | |
| IO.popen('(spork&) 2>&1') do |messages| | |
| puts(message = messages.gets) until message =~ /ready/ | |
| exec('autospec') |
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
| Pistachio 1.9 procedure | |
| freels-mongrel | |
| http://pauldoerwald.ca/2009/6/15/ruby-1-9-rails-and-unicode-nightmares |