« first day (811 days earlier)      last day (4138 days later) » 

4:00 PM
 
Here's a fiddle to demonstrate the problem: jsfiddle.net/QDUg6
In its current state, the request succeeds. But if the line with the custom header is uncommented, then the redirect is cancelled.
 
@SimonSarris Sweet!
 
@AmaanCheval / @SomeKittens I like the editor on Blogger because it retains the copied HTML from the online editors and syntax hilighters
however it's going all nutso on me now
what do you use to display code?
 
@rlemon Embedded gists
 
ugh.. I wanted to 'break down' my code line by line
that would be a lot of gists
 
4:07 PM
That's the simplest way I could think of when I needed to display code yesterday. It was really late, so I didn't bother looking into the SyntaxHighlighter plugin
!!/google SyntaxHighlighter blogger
 
it's just changing shit
 
@rlemon I'm lame and just copy/paste into the blog and click "quote"
 
I... want... cat... hat...
 
4:09 PM
Check the HTML?
 
when I click 'Save' / 'Update' it f bombs it all
ohh yea the HTML is a mess.
direct copy paste from gist so I could get the sexy syntax hi lighting
it's what i did for EVERY other post I've made
so I don't get it
 
There must be other HTML messing it up above, then
 
bah, i'll redo it later. it's drafted anyways
 
m59
Good morning!
 
@m59 morning govner
 
m59
4:14 PM
Easy peasy questions today... if I want to call a function by either foo.bar() or foo[bar]()
ermmm
actually foo[3]
json?
 
foo["bar"]() would also work
 
m59
yeah my mistake
 
bracket notation takes index or named key.
 
@m59 Whaaat?
 
m59
I meant as a number
 
4:16 PM
but index only on arrays or lists
not on object, objects are key value pairs not index'd lists
 
@rlemon hehe or even window.foo.bar() :-P or window['foo'].bar()
etc....
 
we're discussing bracket vs . :P
 
var bar = 'bar'; foo[bar]();
 
m59
yeah I need indexed, but names also
 
@rlemon haha ur no fun
 
4:16 PM
not window object being a whore
 
@rlemon eh? There's no difference between indices and key names.
obj.foo is just sugar for obj["foo"]
 
@Zirak yes but if you have key names they are not mapped by incremental numerical indecies
!!> var obj = { 'foo': 'FOO', 'bar': 'BAR' }; console.log(obj.foo, obj["foo"], obj[1]);
 
All key names are strings; array key names (which, coincidentally, can sometmes also be presented as integers (don't forget you can assign random key=>values to arrays too)) are converted to strings; arr[0] is turned to arr["0"]
 
@rlemon "undefined" Logged: "FOO","FOO","undefined"
 
That's just array sugar. 0, 1 etc are key names like any other. Arrays just abstract the need to explicitly declare order.
 
4:19 PM
@Zirak ok, but you're missing the point I was trying to make... it's not a list.. it's not an array... it's a key value pair.
 
There was a point? I was just bored so I pestered you.
 
this gets confusing if you're used to Collections, Lists , or Dictionaries
which can have a key AND an index to reference by
@m59 has all of this answered your question? you might need some refactoring
 
m59
lol
this confused the freak sauce out of me.
 
what is the purpose?
you have a list of what and you need to this to it.
 
m59
I'm just trying to make my code a little more pleasant to look at.
 
4:21 PM
Hi everyone!
 
lol
 
m59
I need to be able to right foo.bar and access is foo[0]
it*
LOL
english fail
write*
 
how is the object structured
 
m59
it's an array right now
 
I am scared by what you plan to do
 
4:22 PM
is it OK to come here just to ask quick questions?
 
Yeah, don't do that
 
@figha Sure
 
m59
@figha yep!
 
@figha yes ask away
 
@m59 I don't think you should either
 
m59
4:22 PM
kill myself?
 
@m59 so we dont end up with an XY problem, tell us more about what you are doing
 
m59
lol
 
@m59 yea... not gonna happen boss. not without a supremely complicated solution that will rape performance
 
m59
oh, suck.
 
4:23 PM
ok thanks! anyone here has experience with ExtendScript?
(js scripting for photoshop)
 
(and other adobe stuff)
 
nay
I looked at it because it looked cool but then I started using GIMP and never looked back at adobe
 
@m59 It's very doable with getters/setters, but you really, REALLY don't want to use that. I'm gonna write it anyway.
 
m59
wait
javascript doesnt have what php has?
 
4:24 PM
I try to stay away from anything made by Adobe.
(Made of adobe is ok)
 
m59
I mean....the array that does both?
 
javascript !== php no
 
m59
that sux
 
:( okay
 
javascript === php
 
4:24 PM
you do not define the key on a js array
 
by the way I used gimp once and didn't like it, but should try again after a few years and much more experience
 
Dude, we've been through this. Objects are plain key=>value maps.
Arrays automatically decide on keys.
 
m59
yes
 
@Zirak why do you repeat what I say slightly more elegant?
echo jerk.
:P
 
m59
I was stuck in php mode I guess. In php, I'm pretty sure that an array has both a name and a number.
 
4:25 PM
I am the jerk this chat deserves.
 
m59
at least, if it's that kind of array.
 
main question: what is the use case for needing to reference by both name and index?
 
m59
@Zirak I've been working with your ideas and trying to set it up in a way that feels more natural. I came up with a really cool template but it had a small drawback.
 
@rlemon What do you mean?
 
m59
4:27 PM
To loop through properties in order.
 
@Neal wasn't talking to you
 
m59
but not have to declare the array by number
 
@SimonSarris hah nice glad to see someone made a site of those!
 
@rlemon still.
 
they were originally posted on reddit, and then on opengameart.org
I used some in my match game
One guy made most of those.. pretty insane
 
4:28 PM
@m59 Haven't we solved that already? y'know, having an internal array?
 
m59
yes
 
sites running so slow though
 
Do I have to repeat what I've said 4 times before...again?
 
m59
arggg
do I also? :)
the naming sucks
 
Deal with it
 
m59
4:29 PM
I am :)
 
You're not dealing with it hard enough
DEAL WITH IT HARDER
 
m59
haha
I dont want to say action[0] = function() { //do this}
I want action.actionName = function() { //do this }
 
why not do that then?
 
so make an object.
 
You can't have both ordered and unordered stuff
 
m59
4:30 PM
object traversal is fail
 
var action = {}; action.actionName = function(){};
 
He wants to execute the actions in a specific order
 
m59
^
darn you javascript! become php! RITE NEOW
 
var action = {};
action.actionName = function() {};
action["0"] = action.actionName;

action["0"]();
action.actionName();
 
Here's a compromise: Have the array store the key names, and the loop with execute it
 
4:32 PM
that will do it, but its not very good form and @rlemon frowned as he wrote it
 
m59
I was thinking json was the answer to all of this.
 
nay
json is for passing around information and nay more
 
var i = 0;
for( var prop in action ) {
    action[i++] = action[prop];
}
 
JSON? JavaScript Object Notation? How is that related to anything?
 
@m59 lulnowayplz
 
4:33 PM
@Zirak I think he meant something like [{id:0, name:"foo", action: function() {} },{id:1, name:"bar", action: function() {} }]
 
m59
I felt like in json they were interchangeable.
 
@canon He didn't, we've been on this for 2 days now.
 
ah
 
var action = [];
action.push({id: 'actionName', func: function(){} })
why not that?
 
he wants object keys to be accessible by index (int)...
var obj = {};
obj.key1 = 1;
obj.key2 = 2;
obj[0] == obj.key1; // he wants this
 
4:34 PM
there are a thousand sort-of ways to do this, most of them bad for
m
lets step back anyway
what the hell are you trying to do?
 
m59
haha
 
why do you want this in the first place?
 
m59
crazy reasons.
 
@SimonSarris we'be asked him this MANY times.. we still don't know
 
m59
ocd mainly.
 
4:35 PM
not that its bad to want, but there might be something cleaner
 
m59
I'm totally for something cleaner.
 
var obj = {
    actions : [],
    call_actions : function () {
        this.actions.forEach(call, this);
        function call (methodName) {
            this[methodName]();
        }
    }
};

obj.thingypoop = function () {
    console.log( 'GIVE ME A FOO' );
};
obj.thingyshit = function () {
    console.log( 'GIVE ME A BAR' );
};
obj.thingy = function () {
    console.log( 'WHAT DO WE GET!?' );
};
obj.finale = function () {
    console.log( 'HEPATITIS-C!!!!' );
};

obj.actions = ['thingyshit', 'thingy', 'finale'];
 
well there's nothing really wrong with saying
blah['foo'] = blah['0'] = function() {}
 
Your goal is flawed and your aim is weak. But damn it's fun making examples for you.
 
except you can't write blah.0 ever, which is kind of awkward, and I'd file it under syntax made intentionally disgusting
 
m59
4:36 PM
haha
 
Zirak you're recalling callActions every time you call it...
ah no, my bad
 
posted on January 04, 2013

A few months ago, Opera drafted a spec for a new DSP (Digital Signal Processing) API for JavaScript.  This API would enable access to special vector instructions available to modern processors from JavaScript, and could possibly enable speedups of vectorizable JavaScript code.  Instead of writing a for-loop to do the same computation to every element in an array in serial, you could call a meth

 
m59
    var run = function(inherited) {
	for (var prop in inherited) {
		if (inherited.hasOwnProperty(prop) && typeof inherited[prop] === "function") {
			inherited[prop]();
		};
	};
}

var display = function(object) {
run(object());
};

var object1 = function () {
	return {
		one = function () { console.log('action1'); },
		two = function () { console.log('action2'); },
		three = function () { console.log('action3'); }
	};
};

var object2 = function () {
	var inherited  = object1();
	inherited.two = function () { console.log('actionNOTHING PLAYA!! Action2 got ownt!'); }
 
you could even make a func
var blah = {};
blah.length = 0;
function addFunc(name, func) {
  blah[name] = blah[length] = func;
  length++;
  // doesn't account for duplicate names!
}
then addFunc('hello', function(){}), addFunc('goodbye', function(){})
etc, would give you blah[0] and blah[1] and blah.length = 2, enough to iterate over them
 
m59
@Zirak for my taste, that code is freakin' pleasant to look at. But, later objects cant change things and the methods within each object can't depend on one another.
 
4:40 PM
in your twisted, twisted world
 
m59
I know tons of things that don't work and are not good practice. I really just want to know how to approach my plugin in a GOOD way.
 
There's one thing I failed to ask you...what are you trying to actually do?
 
m59
mmm basically...
basic functions:
playerDiv : attach div to selector that player will load in
loadYouTube api //this will trigger the youtube callback to make the player
that's a plugin right there, done.
so I want an option to just do that
then more functions:
getFeed //does stuff with caching etc.
makeThumbnails
 
...and you can't have it do playerDiv(); loadYouTubeApi(); why...?
So the whole thing was circling around the notion of callbacks?
 
m59
no..
There's limited functionality
then more functionality
then more
 
4:45 PM
Events, dude, events!
 
m59
Should I write a crap ton of if statements?
 
jquery supports custom events, right?
 
m59
no idea what you mean
 
does jQuery support IF's!?! I need to KNOW
 
@Loktar I, what?
 
4:46 PM
I NEED TO KNOW OMG
Im writing the next jQuery Facebook!
/me is just being dumb sorry.
 
I must warn ye ole loke that there is a hole in my brain
 
Is anyone here senorcris on GitHub?
 
haha
 
I am totally incapable of figuring out sarcasm until it is too late
 
4:47 PM
I would delete my SO account if I asked a question like that :?
 
m59
@Zirak my plugin is actually pretty complicated. In my code above, I could get the simple version with display(object1); or the slighly more functional one with display(object2); and so on
 
is everyone an admin but me or something?
 
yes.
 
ffffffffffff
 
@SimonSarris And me
 
I mean
ifffffffffffffffffffff
 
AW SAD
 
wait you're an admin what are you talking about ;P
 
4:50 PM
Woah! I can see the matrix!
 
that felt like an NES video game load
I was typing and the screen flashed
suddenly I'm back in the same place, but this time as a god
 
lol love it how alot of the owners have been here less time than me :-P
 
da-da-da-DA
 
@Loktar :-P
 
So?
 
4:51 PM
We all had to do some naughty stuff to Raynos and Ivo Wetzel
hey I've been here a while actually!
 
I was the creator of the canvas room!
 
I've been here a year, I think
 
I've been here since May
 
many a moon ago
 
@Loktar I said "a lot" not all :-P
 
4:51 PM
not me. I just video taped it all and hold the hard copies as ransom.
 
then they closed it
 
@SimonSarris Me too! It died -.-
 
haha well you might of been here longer than me idk
 
aww man id idle in there
 
4:51 PM
Hey all, I was hoping someone in here could help me with a css issue...for some reason this site (when browser window is shrunk) is refusing to have a overflow-x scroll...
 
Neal has point seniority
 
@SimonSarris LOL
rep means nothing.
 
!!/user
 
I created the CSS and jQuery rooms.. then I abandoned the jQuery room (gallery mode + removed ALL owners :P)
 
4:52 PM
!!/user
 
!!/user
 
@Neal rep means something
 
http://stackoverflow.com/users/322395
:7012271 http://stackoverflow.com/users/829835
 
!!/user
this is a thing now?
 
aww wtf
 
4:52 PM
I've been on SO for 2 years 5 months :O
 
lol mines all jacked
 
neal.... you are right above.. why
!!/undo
!!/user
 
haha sorry
 
2 years, 8 months
 
ddnt know what it did
 
4:53 PM
rlemon, Ontario
6.6k 1 15 36
 
aw yeah you like that boyyy
!!/user
 
!!> JSON.stringify(((function(){return this}).bind(null))())
 
@dystroy "ReferenceError: window is not defined"
 
damnit no gold tags yet.
 
4:53 PM
no silver tags for me
he
 
@m59 jsfiddle.net/VuLNe basically, you want a pub/sub system.
 
m59
Waiiit a minute.
 
@dystroy The bot runs JS in a webworker
 
To be honest rep is a bit of a sore point. I only hound two tags (canvas and html5) which are ~relatively~ unpopular, so my reputation will never be as great as someone who simply peruses the JavaScript tag and gives offhanded answers to very simple questions
 
how can we see our chat history?
 
m59
4:54 PM
still just curious. If you were looping through functions in an array, don't they have to be sorted in order anyway??
 
a detailed, analytical answer to a difficult problem in an unpopular tag will see one or zero upvotes compared to a flippant 5-second solution in a popular tag. This can be discouraging, and I'm not really sure if it needs fixing or not, or how it could be done
 
@dystroy "null"
 
@SimonSarris yeah same here.. although when I go rep crazy ill catch some easy js questions :P
 
@m59 Arrays are sorted by index; objects are not sorted.
 
and yeah the canvas ones seriously sucks sometimes
 
m59
4:55 PM
I mean an assoc array
 
@Loktar I don't think you can
 
Ill spend an hour or more on some questions..
 
@SimonSarris :-P and php is also easy to answer
 
only to get 1 vote.. or 0 lol
 
m59
assoc array is still in the order it was created
 
4:55 PM
there is no assoc arrays in js
 
@Loktar yeah like the "where are my balls" question getting a million upvotes for the simplest bug
 
but! I love canvas/js so its fun at least.
 
objects or arrays
 
"Associative array" is another way of saying "a map" or "a key=>value container", which is what a plain object is.
 
4:55 PM
bleh yeah I know that was dumb
 
m59
screw my brain
 
oh nice @Neal
 
m59
gotcha
 
yes loving the content helps :D besides this is all the encouragement I need:
 
(actually, js objects are hashmaps, but it's the same to you.)
 
4:55 PM
oh wait.. those are just me referring to you :P
 
@Loktar haha. change the search string :-P
 
HE LOVES ME
 
Anyway, yeah, use a pub/sub system. Problem = solved.
 
HE REALLY LOVES ME
 
m59
4:56 PM
@Zirak I'm glad to see that example (learned from it), but that doesn't seem to apply...
 
@rlemon u feel loooooved
 
~_~ then I've failed to comprehend your problem.
 
m59
@Zirak I think I distracted you with the callback issue.
 
actually I feel a bit gassy right now.
 
I <3 @rlemon
 
4:57 PM
Lovin' comes later
 
and @Loktar
 
Same here :P
 
I'd love @Zirak but he will not tell us his or her name
 
It's callbacks! It has to be! You want one thing to execute conditionally after another. That's the very definition of a callback.
 
^
 
4:57 PM
@SimonSarris bite me
 
I <3 everyone! cept the people I dislike or hate. They can fuck off.
 
Theres a few more here I love as well
@AmaanCheval @abhishek
2
@FlorianMargaine, Ryan
3
 
STARS ALL AROUND
2
 
What is this love orgy I've walked into?
6
 
I feel like the only non chat-admin :-(
 
4:57 PM
lol
 
@Zirak you know u <3 it!
 
I wish Ivo would come by more often too
 
Teresko..
but hes not around much anymore
@SimonSarris yeah Ivo is pretty awesome
 
@Loktar hes in php room (teresko i mean)
 
Teresko is always around... he is like the ultimate lurker
same with Amaan.
 
m59
4:58 PM
@Zirak I'm going to just write the plugin and you'll see why it sucks
 
I missed out on Ivo/Raynos....
 
no action for four hours... ping Amaan... 5 seconds later there is a response
 
@rlemon You called?
 
Dievardump
I feel bad I need to stop saying names
 
nay nay
 
4:59 PM
I love everyone mostly :P
 
it is good to say
 
I love Jesus with all my heart!
 
lol well yeah but I notice names I forget
 
I'm here most of the day, but I'm working / have nothing to say a lot of the time
 
ALL YOU NEED IS LOVE (and JavaScript)!
 
4:59 PM
@Zirak He works hard in those fields... have a taco padre
 
Jews of javascript UNIIIITE!!
 
@rlemon @Loktar does that too!
 
lol yeah
 

« first day (811 days earlier)      last day (4138 days later) »