« first day (1825 days earlier)      last day (1430 days later) » 

04:08
@Mirv Absolutely.
Or rather, offset, absolutely. Time zone, not necessarily.
 
8 hours later…
12:13
@Amadan Originally, they come from a file where the location & the timezone are in one - then the offset is derived later on in another section where all the time values are processed - though I can see where the file responsible for loading all the files could call to compute the offset from the other gem & then stick the offset & time in together in place of time zone
 
1 hour later…
13:29
Hrm... I'm not happy with this one but my google~fu is not giving me any love ...

  def get_zone(zone)
    raise ArgumentError if zone.nil?  # to avoid errors in the raise check
    raise ArgumentError, "Non-valid TimeZone" unless Timezone[zone].valid?
    Timezone[zone]
  end

.... I need this to return the Timezone[zone] results, so I can't call the conditional on it as all i get is nil or raiseError ... I feel like it's also going to give me a different error if zone is nil also ... so that means i need 2 guard clauses to handle properly?
13:51
I'm coming up with a new theme song for programming, ... but for some reason the old kids show barney theme or the leg movie themes keep popping up in my head
14:03
All of my rspec tests in one folder are ... this is a sub folder of rspec ...

rspec/time_greeting/time_greeting_spec.rb
rspec/time_greeting/time_greeting_selector_spec.rb
rspec/time_greeting/time_spec.rb
rspec/time_greeting/time_range_spec.rb
rspec/time_greeting/time_in_hours_spec.rb

...do you think I can take time out of the name or should that it it's own module and then mix it into the parent to have proper namespace?
 
1 hour later…
15:07
hello all
hi Qaispak!
I feel incredibly stupid right now. I am touching Node.js stuff after maybe a yea and catching up on arrow notations and all
I have to make a simple rest api. It's working okayish but man is js weird to read
Python.. so much cleaner.
NodeJs is horrid to learn - it's like an early stage react in more than a few ways & there's a reason except for entrenched corp gigs node & react are being passed over for vuejs etc
you don't want to start learning js with node
I love vuejs. BTW I was so into learning vuejs and thought it was awesome. I went to the js chat room on here and they all SLAUGHTERED me for wanting to learn vuejs.
Me being simple minded thought, oh they are experienced and I must be dumb.
but now I know they are just obsessed with react for some reason.
It's just that it's annoying me that I am not good with Node so I keep trying to learn. I want to get good at a functional language. Also, this is a take home test for a company. They said use any language. I know I can do it in ruby or java but I wanted to try Node for fun.
If I can't do it by tonight though I'm going straight up python.
The API itself is meaningless. They mainly want to see how I deploy it/make it available/ would scale it. I got AWS stuff for that
Matz's Twitter thread We are mere mortals
2
15:17
there are more than a few trolls in the javascript room - some of them sexist & racist - i left there because at one point last year I told them some of their comments might not go over well with women & 3 or 4 of them went ballistic with one summarizing it by saying, "i'd ban you (for asking them to not say sterotypes about women) so f'ing fast if i was mod"
Haha that's nice.
Not about the JS room..
but the tweet.
@Jared hugs
yea - their militancy comes out hard - I lurked in there for a year & a half - there's about 9 of them in there on regular basis who will go off topic or just ad hominem on random comers to the channel - I was sick of their toxic natures ... stackoverflow's end will be when those guys get mod
That's the tech community sometimes. Kids learn how to make a few apis and websites and think it gives them a right to be dicks to those that ask questions/aren't as obsessed about a certain language
15:32
I want to play this over the weekend - ruby in unity3d via C, but i'll be trying to resurrect my gaming rig by replacing the cpu fan with a $30 mega fan & the twin cooling fans on the gpu because i need that to run the unity compiling or trying to find a copy of windows to use with my win7 key on the unit ... I really hope the HD didn't die ... I don't know where I stuck the stupid win10 upgrade key i got
Good morning, all.
good morning wayne
Hello Wayne
 
3 hours later…
18:37
so unpopular opinion of the day ... if ruby was really user friendly, gsub would be global_substition & no one would ever ask what's the difference between it & sub ...
User friendly is always in reference to some imaginary user. Ruby's imaginary user is an experienced programmer who is familiar with the language. For that user, gsub is friendlier. But for other users, global_substitution might be friendlier.
This is one of those areas where I think Guido made some mistakes with Python. He made self explicit and whitespace significant because that would make life easier for beginning programmers. But those decisions made life harder for experienced programmers, so not a great trade-off unless the language is intended to be just for teaching.
why can't there just be a config switch for the complier to fork ... is python not OO?
also ... loading/requires always kill me, I've read a ton on the namespace searching & such but there's always a 3 way split between paths/working directories/regular conflicts
I want to be able to require my classes, but never seem to get it to work & since there's like zero useful returns when you use load/require how do I trouble shoot them? I'm an hour in on making a subdirectory & then a small script to load everything in it or require
(byebug) files = Dir[File.join('greeters', '*.rb')].sort
["greeters/greeter.rb", "greeters/greeting.rb", "greeters/greeting_selector.rb", "greeters/time_in_hours.rb", "greeters/time_range.rb", "greeters/time_to_greeting.rb", "greeters/time_zone_names.rb"]
18:53
The system variable $: defines the directories that will be used to look for files when a require or load statement is run. Typically you add your project's top-level code directory to $:, then do require statement that are relative to that directory.
Byebug hates that .... *** SyntaxError Exception: (byebug):1: $' without identifiers is not allowed as a global variable name`
mirv:~/workspace/lib (master) $ irb
2.5.3 :001 > $
Traceback (most recent call last):
        1: from /usr/local/rvm/rubies/ruby-2.5.3/bin/irb:11:in `<main>'
SyntaxError ((irb):1: `$' without identifiers is not allowed as a global variable name)
2.5.3 :002 > exit
mirv:~/workspace/lib (master) $ $
bash: $: command not found
$:
With the colon.
ah!
if I have alot of files, is it bad practice to feed them into system variable $: ?
You just feed directories to it, not files.
Aye - sorry - yes
19:00
There's an over elaborate example here: github.com/wconrad/ftpd/blob/master/bin/ftpdrb . The elaboration is because I need this file to run correctly either in development, or when run as part of an installed gem.
that's pretty sweet is that blob perm?
dev_lib_path = File.dirname(__FILE__) + '/../lib'    # top-level lib dir in development
if File.directory?(dev_lib_path)      # in a gem, that directory is elsewhere
  unless $:.include?(dev_lib_path)    # I don't remember why this check is needed
    $:.unshift(dev_lib_path)          # Add the top-level directory to the search path
  end
end

require 'ftpd'    # requires ../../lib/ftpd.rb, which requires (or autoloads) the rest of the librlary
That blob is part of the project on github, so that link will always show the latest version of that file.
I think your check in there is because it errors like made if you try to do it without having the thing to unset - i've seen similar on thoughtbot's repos - unshifting a method in dynamic programming is hard error, not soft is what i assume
I don't think it's an error to have the same path in $: twice. But it is messy. I don't recall why it got messy at some point.
Unshift just adds something to the beginning of the array. It's not magical.
oh, in dynamic programming thoughtbot group must use it to move their custom stuff to the top of the search priority for namespaces etc - which would cause errors for them later
19:07
in ftpd I did not use autoload, so the top-level file just requires everything that the library needs, one file after another: github.com/wconrad/ftpd/blob/master/lib/ftpd.rb
omg wayne ...
That's kind of the point where I'm at but I spend so much time mucking about while i'm learning I wanted to do it dynamically
In addition, each file requires any files it needs, even though the files are loaded in the top-level file. For example: github.com/wconrad/ftpd/blob/master/lib/ftpd/cmd_epsv.rb
That is done because the required file may be later in top-level file, and so not loaded yet. The top-level file is alphabetical for simplicity of maintenance. I do not, and would not, try to order the top-level file to solve load dependency problems.
As an alternative, if the top-level file were to set up autoload, then no require statements would be required in any individual files. I did not set up autoload in this project, because of concerns that it was deprecated. Indeed, it has been deprecated for many years, but it still exists, and I think the problems that caused it to be deprecated have been solved.
I was wondering about that earlier today - half my fight is that I need to load from the root of the project lib sometimes & othertimes I need to load from the sub dirs
I just Dir[File.join('*.rb')].sort.each{|x| load x unless defined? x} or use require in place of load
# With the top-level being added to $:, you can load another
# file as relative to the top-level:
require "ftpd/cmd_cwd"
# or load it as relative to the current file.  Here, the current file
# is in the ftpd directory
require_relative "cmd_cwd"
Prefer "require" over "load". Load will load a file even if it's already been loaded, which can cause errors or warnings.
Yea - I'm kind of thinking of << 'lib', then << 'lib/sub1', then << 'lib/sub2' ... etc
19:16
I don't understand. I think you elided too much from your example.
I do - because load will give me infinite loops in ruby, but in rails load is preferred do to some special sauce
$: << 'lib'
$: << 'lib/subdirectory1'
$: << 'lib/subdirectory2'   # type situation or make a loop of it
Better to just add "lib" and then require, e.g., "subdirectory1/foo".
You should not need to add every directory to the load path, just the top-level one.
that chaining of subdir1/name.rb is a source of lots of pain when renaming stuff as i revise this project
    rspec/time_greeting/time_greeting_spec.rb
    rspec/time_greeting/time_greeting_selector_spec.rb
    rspec/time_greeting/time_spec.rb
    rspec/time_greeting/time_range_spec.rb
    rspec/time_greeting/time_in_hours_spec.rb

I have 50ish files so far & half of them need to be renamed, then wrapped in modules...so custom rolling dynamic require or loading will take me more than a day or two
I use multi-file recursive search/replace for directory renames.
But usually, when I have a subdirectory, there's a single file in the directory above, named after the subdirectory, which is responsible for loading all of the files in the directory.
i'm not sure i trust my skills that far to cmdline script it versus IDE search for any files then open them and run replace in visual mode
19:24
So, subdir.rb is the only place that does require "subdir/foo", for example. It's easy to search/replace the paths in one file.
that seems like a lot of steps to effect a change to have a file to track it all? ....maybe i'm just overwhelming myself mentally?
It's the simplest way. Having all of the subdir requires be in one file makes life very easy. Anyone needing that subsystem loads that one file, and that one file does the rest.
I think you're just overwhelming yourself. It's pretty simple.
I'm going to back up my project now (should have done that yesteday when i finished a working version), then branch and take a wack at using find/sed to handle those replacements, it's time to "hu~Man" up and use my skills more - askubuntu.com/a/84013
20:26
omg - love this feature - ruby -e 'puts $:', my pp wasn't doing it inside irb
:) yeah, -e is neat
That's because pp is a standard library. Try either ruby -e 'p $:' or ruby -e 'require "pp"; pp $:'`
hrm, gotcha - also - why doesn't $: or $LOAD_PATH contain my root workspace? - i need to bone up on vanilla ruby books I think
In a gem is required, its lib directory is added to $: automatically. Otherwise, it's up to you.
The reason is that Ruby doesn't actually know what your root workspace is.
For example, in mygem there can be a bin directory and a lib directory. The lib directory is actually what gets added to $:, but it's not the top-level directory when developing.
i'm developing out of my lib ... am i doing it wrong?
20:44
You don't have to use gem organization for a non-gem project. I usually do, but there's no requirement for it.
That said, what does "developing out of my lib" mean?
I've got ... workspace as my user root on the virtual C9 ide. Then inside it I have lib, spec ... all my code goes in lib & tests in rspec's spec
That's pretty much standard gem layout for a library.
21:35
omg - all the finds & sed's in the world - i'm a pro now guys! I RAN a script on my dev env & it worked :)
now i just need to find someone to pay me to do this script every 4 hours :)
21:47
Haha, yeah.
 
1 hour later…
23:35
So changing the names was the easy part - abstracting TimezoneName class was about 45 minutes, 30 of it figuring out why one test as so brittle - turns out I had made my order time dependent by trying to call all my evaluation at the beginning instead of just the init args check
Are you using timecop? I turn to it when testing code that works with time.
I'm not - what I have right now seems ok, but i'm putting it into my notes - unless you're saying that it handles code, versus's testingcode
I see what you're talking about & instead I "anchored" the timestamps with helper to adjust for the old data the people were using

« first day (1825 days earlier)      last day (1430 days later) »