Firstmate

Firstmate

Joined
Jul 31, 2008

Activity Stream

Firstmate   -  May 31, 2012

@Hawkee Is there anyway to 'unfollow' a snippet/script? I often get notifications from snippets I had made a comment over many months ago.

Firstmate commented on a Page, BaseConverter  -  May 16, 2012

You should theoretically allow bases beyond a radix of 16. I see your switch only goes to F/f, when it should go to Z/z. To make it easier on yourself, check whether it's a letter and uppercase and convert to lowercase if so. Then do the standard equation you are using to convert it to it's decimal representation.

My two cents.

 Respond  
Firstmate commented on a Page, dynamic multidimensional arrays Example  -  May 03, 2012

Consider it? If it's a matter of performance (and I'm not expert on the matter), in your snippet you're iterating so much more than necessary. Consider your 2x3x4 example. Mine would iterate (234) or 24 times. In your case, you loop 2 + (23) + (23*4) or 32 times. And these are just small dimensions. Again, I'm not too knowledgeable but surely you can see the optimization in this.

 Respond  
Firstmate commented on a Page, AutoMagic URL Shorten-er™ (using goo.gl)  -  May 02, 2012

This is where I remember seeing his script a long time ago.
$getsource: http://forum.swiftirc.net/viewtopic.php?f=74&t=24161

Nice script by the way.

 Respond  
Firstmate commented on a Page, dynamic multidimensional arrays Example  -  May 02, 2012

I'm not sure if this was done more out of demonstrating the code, but why not take:

    double ***ptr3;
    ptr3 = new double**[2];
    for( int i = 0 ; i < 2 ; i++)
    {
        ptr3[i] = new  double*[3];
    }
    for( int i = 0 ; i < 2 ; i++)
    {
        for( int j = 0 ; j < 3 ; j++)
        {
            ptr3[i][j] = new  double[4];
        }
    }

    for( int i = 0 ; i < 2 ; i++)
    {
        for( int j = 0 ; j < 3 ; j++)
        {
            for( int k = 0 ; k < 4 ; k++)
            {
                ptr3[i][j][k] = ( i * 3 + j ) * 4.1 + k * 0.1;
            }
        }
    }

And make it:

    double ***ptr3;
    ptr3 = new double**[2];
    for( int i = 0 ; i < 2 ; i++)
    {
        ptr3[i] = new  double*[3];
        for( int j = 0 ; j < 3 ; j++)
        {
            ptr3[i][j] = new  double[4];
            for( int k = 0 ; k < 4 ; k++)
            {
                ptr3[i][j][k] = ( i * 3 + j ) * 4.1 + k * 0.1;
            }
        }
    }
 Respond  

I'm pretty sure this is a rip (apologies if not). I've had this little snippet in my remotes that I got from someone for a long time:

alias np {
  if (!$com(itunes)) { .comopen itunes iTunes.Application }
  if ($com(CurrentTrack)) { .comclose CurrentTrack }
  noop $com(itunes,CurrentTrack,3,dispatch* CurrentTrack)
  noop $com(CurrentTrack,Artist,3)
  var %artist $com(CurrentTrack).result
  noop $com(CurrentTrack,Time,3)
  var %time $com(CurrentTrack).result
  noop $com(CurrentTrack,Name,3)
  var %name $com(CurrentTrack).result
  noop $com(CurrentTrack,BitRate,3)
  var %bitrate $com(CurrentTrack).result
  me Now Playing: Artist: %artist Track: %name Time: %time Bitrate: %bitrate
  .comclose CurrentTrack
} 
 Respond  
Firstmate commented on a Page, Variable reader ($vget)  -  Dec 28, 2011

He means like %test hello, $var(%test hello)

 Respond  
Firstmate commented on a Page, Variable reader ($vget)  -  Dec 28, 2011

@WorldDMT: Instead of looking at the examples, if you look at the snippet, you'll see he loops around $0.

 Respond  
Firstmate commented on a Page, Variable reader ($vget)  -  Dec 27, 2011

Yours is not...The OPs allows for any number of arguments, i.e. $vget(blah, test, foo, fah, words,46) Like I mentioned in my first post. Try your script with a variable of that nature and you get: "%blah.test is not set!"

 Respond  
Firstmate commented on a Page, Variable reader ($vget)  -  Dec 27, 2011

Well, either way, just like yours it wasn't fully tested. I just wanted to indicate your example was different the OP's snippet.

 Respond  
Firstmate commented on a Page, Variable reader ($vget)  -  Dec 27, 2011

No idea. Not on my windows puter atm, but I'm sure I had a reason...I just can't remember it.

When does it not work? I didn't test it fully either.

 Respond  
Firstmate commented on a Page, Variable reader ($vget)  -  Dec 27, 2011

Woops, it should be checking if $($+($,$0),2) is 0. Nice catch.

 Respond  
Firstmate commented on a Page, Variable reader ($vget)  -  Dec 26, 2011

Well his is organized so that you can supply any number of parameters, i.e. $vget(blah, test, foo, fah, words,46).
However, I agree in that a loop isn't necessary. Here was my take on it:

alias vget {
  tokenize 32 $($1-,2)
  var %d $iif($($+($,$0),2) != 0,$v1)
  var %e $($+(%,$replace($($iif(%d,$+($,1-,$calc($0 -1)),$+($,1-,$0)),2), $chr(32), $chr(%d))),2)
  if (%e) return %e
  else return Variable not set.
}

Though as you mentioned, you made yours for readability :V

 Respond  
Firstmate commented on a Page, Sticky Note Custom Window  -  Dec 24, 2011

I would say no to using the Insert key, and stick to the 'i' Key, because Insert does not imply entering some edit mode, but rather the type of insertion (overwrite versus overtype) when you type.

 Respond  
Firstmate commented on a Page, Digital Clock  -  Dec 24, 2011

Well, you can always download a font that matches it. Get the bg color of the text (essentially drawing 88:88:88 88) and draw over that.

 Respond  
Firstmate commented on a Page, Digital Clock  -  Dec 24, 2011

I like your implementation as well, but in mine you can configure the format how you want. That's why the window width is not set statically.

 Respond  
Firstmate commented on a Page, Digital Clock  -  Dec 23, 2011

Here was my take on this:

alias digTimeFormat return ddd/HH:nn:ss TT
alias digTimeFontSize return 10
alias timebar {
  if (!$isdir(digTime)) mkdir digTime
  if ($toolbar(digTime)) { echo -s Toolbar already loaded | halt }
  window -hp +d @_digTimeWin -1 -1 $calc($width($asctime($ctime,$digTimeFormat), Tahoma, $digTimeFontSize) + 10) $calc($height($asctime($ctime,$digTimeFormat), Tahoma, digTimeFontSize))
  .timerDigTime 0 1 updateDigTimeWin Digital Time
}
alias -l updateDigTimeWin {
  clear @_digTimeWin
  drawText -r @_digTimeWin $rgb(0,204,0) Tahoma $digTimeFontSize 3 3 $asctime($ctime, $digTimeFormat)
  updateDigTimeToolbar
}
alias -l updateDigTimeToolBar {
  drawSave @_digTimeWin digTime\digTime.jpg
  if ($toolbar(digTime)) toolbar -p digTime "digTime\digTime.jpg"
  else toolbar -a digTime $qt($1-) "digTime\digTime.jpg"
}
alias timeBarOff {
  toolbar -d digTime
  window -c @_digTimeWin
  .timerDigTime off
}
 Respond  
Firstmate commented on a Page, Sticky Note Custom Window  -  Dec 23, 2011

I think a good suggestion would be for other notes to be loaded in a side-listbox.

 Respond  
Firstmate commented on a Page, Sticky Note Custom Window  -  Dec 21, 2011

You know when napa comments on the compression, there's something to note.

 Respond  
Firstmate commented on a Page, Word Definition   -  Dec 14, 2011

You guys are being so silly. He gave a legit suggestion. Stop provoking each other =\

Great script btw, it'd be cool to work in a few different sites like webster and stuff. I think a google, define: might give some better results.

 Respond  
Firstmate commented on a Page, Zombie Shooter (Updated 06/11/13)  -  Dec 13, 2011

--deleted-- I'm retarded

 Respond  
Firstmate commented on a Page, Quine  -  Nov 28, 2011

I understand what you're saying, but a quine just has to show the re-output whatever you typed to trigger it.
By your logic, you could say Jaytea's might not be a quine because it doesn't show the source for $me or $ctimer.

 Respond  
Firstmate commented on a Page, Quine  -  Nov 28, 2011

argv0 posted this and I thought it was a really simple, cool one.

on *:INPUT:*:if (/* iswm $1-) set %lastbind $1-
alias lastbind return %lastbind

The quine is produced when typing //echo -a $lastbind

 Respond  
Firstmate commented on a Page, The simple addictive game  -  Nov 25, 2011

Yeah! Thanks, I knew something was wrong, but neither the motivation or time to figure it out.

I did take a look and saw you had an installer, so chances are pretty high that I'd take back my previous comment.

 Respond  
Firstmate commented on a Page, The simple addictive game  -  Nov 25, 2011

Wims, I believe that is in part due to the setup required to run PacMan. Don't get me wrong, I played it and loved it, but a snippet trumps a script in it's easibility (don't think that's a word, ha) to load.

 Respond  
Firstmate commented on a Page, Up Time Percentage  -  Nov 04, 2011

Jethro, you started it, let's not try and get fancy...
I'm not taking sides, you both are being silly, but c'mon...

 Respond  
Firstmate commented on a Page, Imgur Image Rehoster  -  Oct 16, 2011

You'll have to create a POST socket and, using binvars, send the image bytes. In this manner, the socket will see it as an image. I think there are several examples laying around Hawkee, I'll try to find one and post back before anyone beats me to it :p

Edit: http://www.hawkee.com/snippet/4948/ looks like a good one

 Respond  
Firstmate commented on a Page, Badwords detection engine  -  Oct 15, 2011

A couple of things, the major being removing all these global variables.

You can do that with something like:

on *:TEXT:*:#: { 
  badword $1-
}

And later use it as such in the alias like:

alias badword {
;Looks how many lines is in your text file
  var %lines $lines(badwords.txt)
  var %s 1
  while ( %s <= %lines ) {
    if ($read(badwords.txt, %s ) isin $1-) {
    ;....continue code

What I'm really trying to suggest is your usage of global versus local variables (/set versus /var).

Hope that helps!

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.