« first day (1281 days earlier)      last day (3653 days later) » 

9:01 PM
I'm confused :(
 
@Raine I never really understood functional programming. To me it always just sounded like programming with functions... ha
also known as programming
 
@Oleg Yeah I'm not explaining it well :). The short, less rigorous version is: var myFunc = function() { ... } is NOT point-free. var myFunc = SOME_OTHER_EXPRESSION_THAT_EVALUATES_TO_A_FUNC is point-free. :)
@twiz functional programming is not programming with functions, despite the name, but programming with values. It treats programs as a combinations of values rather than a series of commands.
 
@RyanKinal The definitive guide...? Do you really think its better than a reference like MDN?
 
What is a command defined as?
 
9:04 PM
Functional programming will change your life :). Oliver Steele's library, while outdated, contains all the most important functional-programming-style functions you need.
 
that was generated in 8.298 seconds...
it's a 1024*256 map of mine
seed 3301 in case you were wondering
 
@t1wc nice work
 
@t1wc Oh, I just remembered what that reminds me of. Worms!
 
@twiz A statement (vs an expression). e.g. if(a) { n = 10; } else { n = 20; } vs n = a ? 10 : 20.
 
@rlemon thx
@twiz actually... you're right!
 
9:07 PM
@Raine and now I'm lost again...
 
@twiz Clarification: An if statement is a statement while a ternary is an expression. An expression evaluates to a value. A statement is just a command that is executed. Statements are less flexible since they can't be substituted anywhere a value could be used.
 
hmm ok, I suppose that makes sense
 
ohh wow, the framerates on my own demos is so much better now
:)
 
@twiz It's okay, functional programming is a bit of a "secret club". (Most JS develops don't know what side effects are :o)
Functional programming allows you to focus on combining values instead of control flow. It is a higher level of abstraction.
 
Yea, I still have no clue what good it does to make that distinction, but at least I somewhat understand it now. haha
 
9:09 PM
@twiz Yeah it can seem abstract for sure
@twiz Oversimplified but extremely helpful and will make you a better programmer: Side Effects are, if not evil, to be avoided. Writing pure functions will result in code that is less error prone, easier to test (think unit tests) and easier to reason about.
 
So basically a function will only manipulate variables within its own scope?
 
make sure to click "show video"
 
@twiz Yup! Results in much better code. Pure input/output.
 
@twiz yeah. Now try to apply this principle when modifying the content of a file.
 
If I'm taking a file data stream as input, modifying stream and outputting it as return value, will it be considered a function with side effects?
 
9:16 PM
FP has its pros and cons. The main con is that many things have side-effects in real life.
@Oleg can you reproduce the same input -> output twice in a row? If you can't, there are side effects
 
@Oleg If I'm understanding you correctly, that would be considered a side effect. Modifying the stream that is passed in (that is, from another scope) is considered a side effect regardless of the return value.
 
watched fargo
seems like a keeper
 
When using fs.readFile() in a Node app, can I just pass 'path/to/file.txt' or do I need to do path.join(__dirname, 'path/to/file.txt') stuff?
 
@FlorianMargaine yup, idempotence is a good test.
 
In a way, it sounds very similar to writing modularized code. Obviously you don't make everything a module, but modules often make sense.
 
9:18 PM
Wait... a sum function is not side-effect free?
 
@ŠimeVidas seems easy enough to test :)</jerkresponse>
 
s/jerkresponse/realresponse
 
@Raine I don't want to rely on my (likely flawed) testing.
 
@FlorianMargaine In my experience, just minimizing side effects to a smaller portion of the program (say 20% of functions instead of 50% of functions) results in much more stable code.
 
flawed? you either read it or you get an error
 
9:19 PM
ok guys... working on world options
 
@ŠimeVidas That's how you develop your debugging skills :D
 
meaning I'll start making text fields in the canvas
 
@twiz yes
 
meaning I will ragequit in less than 3 minutes
 
@Raine yeah. I just saw you advocating FP without stating the bad.
There's a reason haskell isn't used everywhere
 
9:20 PM
@Oleg A sum function like function(x,y) { return x+y; } is side-effect free.
 
Hmmm... I think I just realized that I probably use FP quite often... haha
 
@BenjaminGruenbaum hi
 
@FlorianMargaine I won't hide that I'm a fp fanatic. Maybe Haskell should be used everywhere :)
 
@Oleg a sum function will always return the same output when the same input is given
 
I might have to look through some of the code I've written...
 
9:21 PM
@Mosho If it works for this one thing, that does not mean that it would work in other, different circumstances.
 
@FlorianMargaine I like the js/node community too much to use Haskell tho :)
 
@Raine no. Haskell sucks at real life where side-effects are real
 
Then, succ function has side-effects.
 
@ŠimeVidas That's why you test it in an isolated environment with a representative case.
 
9:22 PM
@tereško hi bestie
 
@Raine What if both work?
 
Oh, I see what you did there.
 
@twiz Yes, once you start thinking about side effects and encapsulation you see opportunities everywhere.
 
Side effects are awesome :)
I love side effects, especially global ones.
 
@BenjaminGruenbaum flagged :P
 
9:23 PM
Gonna get me that mutable global state like a champ.
 
@BenjaminGruenbaum No, you are awesome
 
First thing I did in JS is implement a singleton.
 
Who doesn't love errno.h
 
Isn't Javascript basically nothing but singletons? haha
 
Eh, no? I rarely see singletons in JS to be fair
 
9:25 PM
Isn't a singleton in JAvascript just an object? haha
 
Not really.
 
?

cd ~/test
echo "blah" > a
node
>>> fs = require('fs', 'utf-8')
>>> fs.readFile('a')

Works!
 
@Raine no it's not.
 
Can one have two identical objects?
 
@Raine Accessing x and y is a side effect, they might have getters that delete Function.prototype.call for what it's worth. y might have a .valueOf that does alert("LOLOL")
 
9:27 PM
Can one have two identical red balls?
 
Yes.
 
@Oleg identity is something you define.
 
Well, I guess two things cannot occupy the same space in memory.
You can have two pointers to the same object.
 
@Oleg not on a conventional computer.
 
@BenjaminGruenbaum I'm assuming x and y are primitives. Your examples aren't too realistic.
 
9:29 PM
@BenjaminGruenbaum You could make restrictions for some reason to make it more of a traditional language singleton, but would there really be much point in that?
 
Fantastic idea.
 
I can't say I ever actually tried to use a singleton in Javascript
 
@twiz a classical language singleton is just a hidden global variable.
 
There are more elegant ways to do what it does, for example - not using global variables.
 
9:29 PM
@twiz Objects as "namespaces" is an examples of a singleton in js.
 
@Raine That's what I'm trying to say. haha
I think.
 
@Raine I'm wondering if there's any valid reason to prepend __dirname (e.g. better portability/compatibility).
 
@twiz var singleton = {}
3
 
@Zirak cute.
@Raine only in browsers.
 
@ŠimeVidas yes there are reasons
depends where you're calling your script from
 
9:31 PM
@Oleg Express's app.js file
 
@Zirak that's not a singleton in the pattern sense.
 
@ŠimeVidas and where is it?
 
@ŠimeVidas if you prepend __dirname, at least use path.join
 
@BenjaminGruenbaum Yes, of course :)
 
@Raine that's a very bold assumption in JavaScript.
 
9:32 PM
var superSingletonPremiumDeluxe = (function () {
    var singleton = {};

    return function () {
        return singleton;
    };
})();
 
@Oleg The main (and only) JS file of my web app. I have a global function declaration in there and I use fs.readFile() in that function.
 
@Zirak copy is here :)
 
Yeah, that's more like a singleton. If you have superSingletonPremiumDeluxe available to users.
 
@Oleg Ah, it's in the root :)
 
Hello copy
 
9:33 PM
@ŠimeVidas so what happens if you call it from foo/bar directory?
 
hi
@Zirak Where should we go out to eat?
 
@Oleg I only have app.js in the root. No other JS files in my web app.
 
@BadgerGirl oh, you're physically together?
 
hawt
 
@ŠimeVidas the root of what, of all evil?
 
@BadgerGirl You should order pizza, and work on @copy's emulator and pair code.
 
@Oleg My project directory. The directory I deploy to the server.
 
@ŠimeVidas __dirname is the directory that contains the script. A relative path will be relative to the current working directory of where the script is executed from. Usually won't make a difference in an express app.
 
@BenjaminGruenbaum We did that yesterday.
 
@ŠimeVidas what Raine said
 
9:36 PM
And I want to go shopping so no.
 
Ooooh the shopping trap. Good luck @copy.
 
@Raine @Oleg I see. So, as long as I'm in my app.js file which is located directly inside the __dirname directory, I don't need to prepend __dirname (since I can get to all my project's files via relative paths).
 
I only go shopping at places that serve beer.
 
I think he's faking an allergy to escape from shopping.
 
But in a script that is in a sub-directory, I need to path.join(__dirname, '...') to create an absolute path to the resource.
Yea, I think I get it now.
 
9:40 PM
@ŠimeVidas I assume that if you call cd ~ && node ~/my/project/root/app.js that fs.readFile('myfile.txt'), the script will try to read ~/myFile.txt
 
@ŠimeVidas Well... it depends on where app.js is executed from. node app.js in the same directory will have the relative path from the current directory. If you cd ~/ and run node ~/projects/myproject/app.js then relative paths will not be relative to the app directory, but to ~/. Hope that makes sense :)
@Oleg beat me to it :)
 
By the way, I've never read "rules.javascriptroom.com". Am I still gonna be eaten or you've given up on me?
 
!!mute Oleg
 
@BenjaminGruenbaum Please give mute duration, see /help mute
 
Sorry, rules are rules.
 
9:43 PM
!!does Benjamin hate me?
 
@Oleg All signs point to yes
 
T_T
 
aw man, I think I've just killed a baby rabbit :(
on easter of all days
 
Join the club
 
@Oleg @Raine I see. Hm, I use the "grunt-express-server" task to start the server on my local machine, and on my web host I just modulus deploy my project directory, so I'm not sure how the app is being initiated on the (production) server, but I'm assuming that in both cases node app.js is called.
 
9:47 PM
!!should ŠimeVidas use __dirname?
 
@Oleg All signs point to yes
 
^ Caprica's never wrong
 
Is this really JavaScript in action? imgur.com/UhcMb7l
I can't believe it...
So cool! :)
 
@sammyg What can you not believe?
 
@sammyg Spoiler: You can even see how they did it.
 
9:50 PM
@Zirak o/
 
@rlemon 8/10
 
chops your remaining arm off
 
improving, nice.
 
@ŠimeVidas Just how versatile JS can be. So dorky! :)
src="http://s.imgur.com/min/404.js?1397684083"
Is this the file that makes the eyes move like that?
Try putting the cursor between the eyes...
 
!!gym today or gym tomorrow
 
9:53 PM
@Mosho gym tomorrow
 
@sammyg You tell us.
 
Hold on
!function(a,b){function c(a){return J.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}function d(a){if(!sc[a]){var b=G.body,c=J("<"+a+">").appendTo(b),d=c.css("display");c.remove(),("none"===d||""===d)&&(oc||(oc=G.createElement("iframe"),oc.frameBorder=oc.width=oc.height=0),b.appendChild(oc),pc&&oc.createElement||(pc=(oc.contentWindow||oc.contentDocument).document,pc.write((J.support.boxModel?"<!doctype html>":"")+"<html><body>"),pc.close()),c=pc.createElement(a),pc.body.appendChild(c),d=J.css(c,"display"),b.removeChild(oc)),sc[a]=d}return sc[a]}function e(a,b){var c={};return
 
>_<
 
...yeah
 
Learning JavaScript by reading minified code. Glorious days.
 
9:56 PM
Haha! I see Russians all over the place... ^^
 
Then you might want to take your medication.
 
LOL!!
 
Yes, come to Mother Russia, we will teach you some JavaScript.
 
@Oleg Are you a professional Russian? :D
 
dafuq
 
10:05 PM
"There is no more deadly weapon system in the world than a Russian with two AA-12s. And keep in mind don't try this at home, I am a professional Russian!"
Pure gold! :D
 
10:26 PM
'night
 
m59
10:46 PM
Line 81 FTF view-source:getbootstrap.com
 
@sammyg if I had to pick 1 weapon for zombie apocalypse
it would be a professional russian
 
@SomeKittensUx2666 NO I LOVE MY TWITTER NAMES
 
@RUJordan SomeKittensUx2666 is afk: gotta help a friend move a couch
 
is it possible to dump the contents of a file into an html file easily?
 
@Crow rename it?
 
10:52 PM
@JanDvorak well, to be more explicit, I am trying to get prism.js style code blocks in a statically rendered html template
 
so, you want a static HTML page that changes dynamically?
 
m59
Hmm...like a liquid brick.
 
@JanDvorak not quite, just styled. I just want it to show the code in a readable way.
 
@Crow get it as text with a request and shove it into a div?
although that's not static :X
 
yeah. Flask behaves a bit oddly with javascript in general.
 
11:07 PM
@rlemon nice man!
glad you got a video card too
lol im putting up a new tv mount as we speak my shoulder is killing me
 
hrm, just looks like my read is coming out garbled
 
11:19 PM
holy shit
my tv//
its insane
itll kill me if it falls on me
I need to take a new pic lol
 
does anyone know of any good tools to format directory structure visually?
 
@Loktar lol
I am thinking of putting some plants behind my monitors
get rid of the TBBT posters
 
@BadgerGirl Since December
 
But when did you start the relationship?
 
11:41 PM
April 1st, 2011. Asked her to formal the week before that, formal was the week after, so we took the average.
 
11:59 PM
 

« first day (1281 days earlier)      last day (3653 days later) »