« first day (2228 days earlier)      last day (2720 days later) » 

9:00 PM
if you're doing it right, adding via chat and loading from file should behave the same
 
@OctavianDamiean 30th of December
 
@ssube But via module might contain some outside calls to APIs etc, no?
 
!!> new RegExp("^https?:\/\/chat\.stackoverflow\.com\/rooms\/\d+".replace(new RegExp('\\.','g'),'\\\.')).source
 
@rlemon "^https?:\\/\\/chat\\.stackoverflow\\.com\\/rooms\\/d+"
 
@Neal sure, but if they want to do that, they develop a full on plugin and give you an API to call into.
If they just want a tell command, templates are much better and safer.
 
9:05 PM
@ssube hmmm true.
 
Especially with handlebars and friends, where you can add your helpers.
it's also easier to get at bits of data
just in general, I prefer the "handlebars for text-to-text and functions for anything else" structure
 
hmmm
 
JS is terrible.
jsfiddle.net/w59a8e2g escaped values are fine coming from a value property, but as soon as I start passing them around they get bullshit tostring called or something
horseshit
 
has anyone heard of Imperial College? As in, heard and kind of know what they do?
and/or consider it more reputable than Cambridge for computer-sciency things?
 
I have never heard of it
 
9:18 PM
jesus finally.
escaping in js is tedious
store the regular expression in a hidden form element and pass it directly from the .value and it works.
 
wutwut
@BenCraig you're british, right?
 
@towc I am not
 
how dare you
anyway, cheers
 
I am a, how do they call us, syrup sucker
 
would you mind casually asking around if you find a good time? Just kind of want to get a sense in the industry of what's known
 
9:23 PM
most people in NA will only know the biggest and most ivy league European schools
I don't think I can name a university further east than GB without some thought
 
Imperial is in GB :P
 
@towc They focus on feet and inches.
 
@rlemon did you ever figure out how to use async funcs in addListener?
 
@Loktar well played
 
2 hours ago, by rlemon
thanks Nathan
 
9:25 PM
@towc and I've never heard of it. They seem to have a pretty good reputation, but have never come in any real context.
 
:p never heard of it though myself, but have of Cambridge ofc.
 
most people only know which schools in their state have good programs
and many people don't even know that
 
^
 
anyway, according to ratings, Imperial is actually the bestest university for CS is Imperial, by a long shot, although I kind of doubt anyone outside of the UK, even if they work in the industry, knows about imperial
 
9:25 PM
hey
 
For the Kerbin nerds, this just showed up. @KendallFrey
 
I can name a shitload of colleges in MI though
 
extension injects code on the page only on the extensions store website -> that code talks with the background.js -> that modifies your storage sync -> that installs gists into your RoboGist from a fucking single click on another website
I'm pretty pleased with myself right now
 
and by a shitload, I mean 10 or so lol
 
are you sure it's not just MI university, with loads of colleges? :P
 
9:27 PM
MI State is an alright one as well, but UofM is the biggest for sure
 
so I'm using a node package to get a user's NT name..but when deployed outside local the requests to this return a 401 and require a btoa token to return the value.
 
^ you guys are confusing with that. we have Universities and Colleges (different concepts) and each have campuses.
 
Is the any way to get the user's NT name from the client or server without needing to pass a set of credentials?
in JS
 
@towc they're pretty obviously marked and most people in the US only pay attention to the uni, not the specific college.
most of the universities here have a few colleges and a couple campuses (the UofM has two campuses and probably a thousand colleges)
St. Thomas' college of business is good, their compsci program is a joke (all group projects, half theoretical/algorithmic).
 
in a quick nutshell -> Universities here give degrees. Colleges here give diplomas (theory vs hands on)
 
9:29 PM
oh
 
I know in C# you can do a HttpContext.Current.User.Identity.Name to get username. Any equivalent in JS?
 
here === Canada
just saying, it's confusing for me when you say a university has colleges
I keep having to remember it means something else
 
here colleges are institutions within a university that ideally go through the same syllabus and provide roundabout the same professors
 
colleges are the field-specific branch of a university
 
so like, you have Cambridge University, but that's the whole city, as there are colleges around the city, that are kind of different, but aren't meant to be
oh gosh. Why can't we all use the queen's english?
 
9:32 PM
> In the United States "college" refers to a constituent part of a university, but generally "college" and "university" are used interchangeably,[1]
> whereas in the United Kingdom, Oceania and South Asia, "college" may refer to a secondary or high school, a college of further education, a training institution that awards trade qualifications, a higher education provider that does not have university status (often without its own degree-awarding powers), or a constituent part of a university (See this comparison of British and American English educational terminology for further information).
seems like Canada uses the queens english just fine 😃
 
specifically: "a training institution that awards trade qualifications, a higher education provider that does not have university status "
 
ohwut
Imperial College London is definitely a University, part of the league of London University
and cambridge/oxford's places are all colleges 0.o
now, if you say that Oxbridge (yes, that's what we call them) are not universities...
blame the queen
 
> Why can't we all use the queen's english?
I was pointing out that we are
 
I was wrong. I'm so very sorry
yeah yeah :)
 
9:36 PM
both Canadas definition and the one you use is correct
 
In the source you gave, it gave a definition for UK colleges too
that's what confuses me
dw
 
@ssube lol "omg was anyone hurt?"
 
the dinosaurs :(
 
I mean, it's likely right, and I'm just experiencing the edge cases. Something the UK has a lot of :P
 
9:37 PM
@ssube a wee bit of poo just peeped out
 
@ssube lol, what losers
ha! @Loktar, remember when they died?!
LMAO, good times.
 
@KendallFrey I'm not sure what that blue pocket is. Either low-pressure something or water.
 
ohwut, we call the bye-bye-dinosaur asteroid chicxulub?
 
@ssube True. So how would you implement tell? How do I get all args after the first one and join them? (since I cannot run any regular js array functions)
 
#earthquake Thanks Trump!
 
9:40 PM
@Neal get args? wat?
 
@ssube Looks like rock samples that they've excavated, examined, and determined where they came from and what happened
 
you just pass an object/hash into handlebars.render
 
I mean, just a wild guess
 
@ssube The person and the info.
 
9:41 PM
@ssube Yes I get that ;-) I want people to be able to create commands from slack itself
 
right
so you have predictable input data (the person who triggered the command, the target they gave, etc)
you put that in an object and each command uses those names
 
"!?addCommand tell@{{{user.name}}} wants to tell you ({{{args.[0]}}}): {{args}};"
 
I still don't get why you can't just use code in your eval
eval(`
function foo(a,...rest) {
	console.log(a, rest);
}
`);
foo(1, 2, 3, 4, 5); // 1, [2,3,4,5]
 
@rlemon bc eval doesnt run through typescript and heroku has a lower node version
 
so don't use ts
 
9:42 PM
{trigger: {msgId: x, user: y}, target: {msgId: null, user: z}, argv: [...]}
 
or write an exception for it
 
then Hello {{trigger.user}}!
 
@rlemon Anything (even babel) wont run in eval.
 
Neal... jesus man
you can't think of any way to get around that?
 
tell is just string templating, this whole TS/eval business is silly
 
9:42 PM
@ssube Yes I have that ;-) I only have the trigger user.
 
NOTEVAL();
// post bundle
s/NOTEVAL/eval/
seriously..
 
@ssube Tell was an example..
 
@Neal you might now
 
@ssube I always did...
that is what the user hash was
 
if you !tell targetId msgId, that becomes a non-issue
 
9:43 PM
but the args contain the other part that will be passed by tell
 
obviously might have to collect data on your own
 
eh?
Then it needs to be a function lol
I have the invoker as user
 
you're a smart man, you can add in another step and replace function names.
don't over complicate things
 
yarly
 
@rlemon hmmm what do you mean? (sorry) how can I use ts (or babel) in eval? is that what you are saying?
 
9:44 PM
this wouldn't be a problem worth spending time on if you weren't complicating it
 
1 min ago, by rlemon
NOTEVAL();
// post bundle
s/NOTEVAL/eval/
@ssube well yea, using eval is a problem in the first place
 
@rlemon What is that? I did not understand.
 
but over coming that is pretty simple
 
yeah
 
But overcomplicating things is so sexy
 
9:45 PM
you can easily keep the eval hack and make it work with TS, or get rid of it and use proper classes
 
@Neal make a step in your build process, AFTER THE BUNDLE, that will s/fn/eval/
I can't simplify it more than that
 
I don't know why you're using TS at all if you don't want to take advantage of the inheritance that will make this super simple
 
@rlemon ... this is node. running ts-node I am quite confused.
No bundle
And the functions are stored on mongo if I use eval
 
-_-
 
Sorry :-(
 
9:46 PM
glhf
 
Not from node.
I dont know node.
 
absolutely 0 bits of this matter if it's node or a browser
they're exactly the same
 
.. ok.
 
this has nothing to do with "node"
 
you're just making up a problem that doesn't exist
 
9:47 PM
Explain to me how you would get a function from a user and then use it within a closed context? That is what I am trying to do.
 
you have predictable incoming data (chat meta data and the message, which you can parse)
handlebars and friends work very well with predictable inputs
for anything with logic or heavy lifting, you can use a function (preferably loaded from module, otherwise just load tsc and pre-compile)
 
^ that is what I have currently with eval which is failing on heroku
 
wrap those in a class that does handlebars.compile and one that does new Function(tsc(body))
 
I am using TypeScript as a learning exercise.
 
Firefox has more bugs within what they call "stable features" than I've ever seen allowed through QA before... bugzilla.mozilla.org/show_bug.cgi?id=1189486
Fucking hell
 
9:49 PM
if you're going to use TS or ES6, it makes sense to start with a contract for all commands, then specialize for tells and for function-backed commands
and just work from there
it's pretty easy to make each command have an invoke(args: any): Promise<string | null> method that runs any logic and returns the response (if any)
 
Hmm yea
I need to combine some of those...
 
so you have the contract, now inherit from it to create one for tells and one for other stuff
 
execute, value and respond are all command executions...
 
the tell one would, in the ctor, compile the template
then execute would just invoke it with the arguments
 
IGNORE TELL.. that was an example. it can be for anything :-)
 
9:51 PM
IT DOESN'T MATTER
you're implementing the contract, you can do it as many times as you want. Tell is just a nice concise example.
you're screwing yourself over by pretending they're different
 
ok. So the "value" ones were the ones I wanted with the eval stuff.
but i think I was doing it wrong (obviously)
i dont know how to pass the string through typescript first
I cannot find it in the docs.
 
@ssube Yes.. I fail at google...
Thank you.
ill check that out.
 
@rlemon ah! didn't see that. you're welcome 😀
 
@Neal obviously it's not super light, since you're working with a full compiler, but it will do what you need. I'd pair it with new Function rather than eval, too.
Keep them cached.
 
9:55 PM
@ssube I have never used Function before. I have Typescript yelling at me when I try that.
 
class TellCommand { constructor({template}) { this._template = handlebars.compile(template); } } and class ScriptCommand { constructor({body}) { this._script = new Function(body); } }
@Neal what's the error?
 
@ssube I dont want to write each and every command. I want them to be passed from slack.
@ssube one sec.
 
@ssube does ts have a @SuppressWarning?
 
depends on the warning
if it's type related, I don't think so?
 
!!afk kitty-post-op 😬
 
9:59 PM
@ssube Hmmm now it seems to be working. Let me see if I can finally remove eval
 
@Neal what's the problem?
cba to read up, if you can summarize
or is it solved
 
eval won't run typescript
the problem is using eval
 
Wait.
bot/command.ts (56,64): Argument of type 'string[]' is not assignable to parameter of type 'string'. (2345)
 
eval compiled code
 
Lines 55-56:
                                    // const value = eval(_command.value);
                                    const value = new Function(['bot', 'channel', 'user', '...args'], _command.value);
its failing on that 2nd line.
 
10:01 PM
huh, it's almost like that isn't the right signature for new Function
 
lol
 
wtf, a mod for rimworld disappered from the workshop, and I can't load me game
 
> new Function ([arg1[, arg2[, ...argN]],] functionBody)
luckily, es6 makes that easy
 
Yep I misread
 
10:02 PM
new Function(...[known].concat(unknown))
 
anyway, naturally you can't eval ts code
 
That look good? :-)
once I merge to master than it will be up on heroku for me to try
 
I think so?
 
Time to test on master ;-)
I think my way of using Function ctr was wrong so I used eval instead :-(
Thanks for the help, lets see if that works
 
cv-pls stackoverflow.com/questions/40730251/… (software rec/req, "What would be a good toolchain to use to build such a site?")
 
10:08 PM
@ssube Boo Function ctr seems to not go through ts either.
I would have thought it would...
 
did you call the TS compiler on the source?
 
why not call tsc.transpileModule
 
15 mins ago, by ssube
https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API
 
and then eval
 
whoo bus time
 
10:09 PM
@ssube On which source? Sorry getting frazzled.
 
eval(ts.transpileModule(source).code) etc. should work just fine
 
@Mosho What I want to do is take the user input and pass bot, channel, user, and then ...args
@Mosho Source being that new Function ?
 
the function body
 
Oh man, it looks like I missed some spiciness on the 17th
 
@Mosho But the issue isnt the function body, it is the arguments.
 
10:11 PM
why?
 
@Mosho The spread.
...args
 
oh that
 
Yea.
 
yeah that won't work
 
Exactly :-(
 
10:13 PM
it can't work
what you can do, however
is prepend let args = Array.from(arguments).slice(3) to the code you get from whoever
 
I can fix this ;-)
tomorrow!
@Mosho Array.from wont work ;-P old node version. that is the whole issue
 
Array.prototype.slice.call(arguments, 3)
 
but if you can upgrade not that might do the trick
 
yay!
fixed it :-)
mazal tov!
Now time to go home to see my wife and children :-)
 
10:33 PM
Quick sanity check, without using something like requirejs or browserify is there a way I can structure a file so that it can be required serverside using module.exports and also used as a script loaded front end without needing separate files?
Also it's cool you can make projects as node projects in visual studio but it keeps reverting to a bloody normal website project
 
export doesn't exist natively on any browsers yet, so you're gonna have to use a lib to get that working
 
Thanks for the clarification @monners :-)
 
Should be simple enough though. import/require server-side where you need it, ditto for your client scripts
 
@Trasiva no, was working on other parts of it
 
The way I've structured it at the moment is by having a src folder with all my 'classes' that use exsports so I can unit test with mocha/chai and deal with code coverage and then once I'm satisifed I've worked through tests removing the server side code and making them functions then minifying and including on frontend
So rather than var foo = function bar()
just function bar()
 
10:42 PM
You don't need a javascript class in order to test
 
so I can make instantiate them in canvas
 
You can have multiple exports in a single file
 
I see, though more files makes me feel comfortable really
also my mocha setup looks for a test and then I'm creating the objects for testing by requiring them
before it goes off to travis ci / code cov / heroku
 
module.exports = {
  foo: require('./blah/foo'),
  bar: require('./blah/bar')
};
 
Sure, group by behaviour. But if you had a script full of validations, you'd probably want to export those validation methods individually, rather than exporting a single validation object full of methods
 
10:45 PM
I'm not quite following here
This is vaguely how things look at the moment, with each thing there being kinda like a class in c# and a single module.exports = Canvas; at the end
Is this a bad practice in js?
I'm a big fan of unit testing, if you wondered xD
 
esdf for life
 
oldschool af
 
ahahah oh dear
 
10:59 PM
lmao
 
Is a 90cm tsunami big/dangerous?
Doesn't seem too bad
 
dunno... sounds like a lot of force
Might be able to carry away a house, no idea how strong that would be
 
Yeah it's pretty bad, it's not just like a regular wave
it just keeps coming
 
with respect to arduinos, are there any tools out there to document the circuits themselves?
 
basically the sea rises by almost a metre, and just keeps pushing inland
 
11:03 PM
Colleagues, some time ago (I think about a year?) it was a challenge/quest from stackexchange (I'm 90% sure it was from them) in js when you were provided a page with a script there and were supposed to craft a url that would trigger the script and output the desired message (I think it was somehow related to their hiring process)
 
Japan is about to be hit by tsunamis
 
watching some of the footage of the previous earthquake's tsunami was really sobering.
 
apparently multiple
 
when?
 
Soon, an 6.9 earthquake happened a little over an hour ago off the coast
 
11:04 PM
yikes.. yeah..just pulled it up
 
Live news english translated: www3.nhk.or.jp/nhkworld/en/live
 
man... :(
 
unfortunately the translator has a very annoying voice :(
 

« first day (2228 days earlier)      last day (2720 days later) »