Latest recipes tagged "javascript"http://code.activestate.com/recipes/tags/javascript/new/2016-08-07T20:41:12-07:00ActiveState Code RecipesMakes html with javascript to animate a sequence of images (Python)
2016-08-07T20:41:12-07:00Brian Fiedlerhttp://code.activestate.com/recipes/users/4194196/http://code.activestate.com/recipes/580675-makes-html-with-javascript-to-animate-a-sequence-o/
<p style="color: grey">
Python
recipe 580675
by <a href="/recipes/users/4194196/">Brian Fiedler</a>
(<a href="/recipes/tags/animation/">animation</a>, <a href="/recipes/tags/javascript/">javascript</a>).
Revision 2.
</p>
<p>Given paths to image files, produces the html file with embedded javascript to animate those images as a web page.</p>
JavaScript WebSocket client for Python + Go WebSocket-based system monitoring example (JavaScript)
2014-01-03T21:09:54-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/578806-javascript-websocket-client-for-python-go-websocke/
<p style="color: grey">
JavaScript
recipe 578806
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/golang/">golang</a>, <a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/sysadmin/">sysadmin</a>, <a href="/recipes/tags/unix/">unix</a>, <a href="/recipes/tags/websockets/">websockets</a>, <a href="/recipes/tags/windows/">windows</a>).
</p>
<p>This recipe is the JavaScript client side of an overall recipe that shows how to do system monitoring using WebSockets, Python, Go (using websocketd), and JavaScript + HTML. The server side of the recipe (in Python, and using websocketd which is written in Go), is here:</p>
<p><a href="http://code.activestate.com/recipes/578803-using-websocketd-with-python-for-web-based-system-/?in=user-4173351" rel="nofollow">http://code.activestate.com/recipes/578803-using-websocketd-with-python-for-web-based-system-/?in=user-4173351</a></p>
<p>The system monitoring example shows the system disk space info (total, used and free) using the Python psutil module.</p>
Calendar (HTML)
2013-10-23T15:55:05-07:00greg zakharovhttp://code.activestate.com/recipes/users/4184115/http://code.activestate.com/recipes/578695-calendar/
<p style="color: grey">
HTML
recipe 578695
by <a href="/recipes/users/4184115/">greg zakharov</a>
(<a href="/recipes/tags/calendar/">calendar</a>, <a href="/recipes/tags/javascript/">javascript</a>).
</p>
<p>Current month calendar. The smallest realization, I suppose.</p>
Verify html form with JavaScript (JavaScript)
2013-07-15T12:19:53-07:00Captain DeadBoneshttp://code.activestate.com/recipes/users/4184772/http://code.activestate.com/recipes/578606-verify-html-form-with-javascript/
<p style="color: grey">
JavaScript
recipe 578606
by <a href="/recipes/users/4184772/">Captain DeadBones</a>
(<a href="/recipes/tags/form/">form</a>, <a href="/recipes/tags/javascript/">javascript</a>).
</p>
<p>I wrote this for a <a href="http://thelivingpearl.com/2013/07/15/the-guest-book-problem/">php Guest Book</a> app I wrote. </p>
Komodo JS Macro - show git blame for the current editor line (JavaScript)
2013-05-28T18:59:52-07:00Philip Cooperhttp://code.activestate.com/recipes/users/4168074/http://code.activestate.com/recipes/578537-komodo-js-macro-show-git-blame-for-the-current-edi/
<p style="color: grey">
JavaScript
recipe 578537
by <a href="/recipes/users/4168074/">Philip Cooper</a>
(<a href="/recipes/tags/blame/">blame</a>, <a href="/recipes/tags/git/">git</a>, <a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/scc/">scc</a>).
</p>
<p>A <a href="http://www.activestate.com/komodo">Komodo</a> JavaScript macro that can show the SCC repository information for who last changed the current line in the Komodo editor - see the screenshot below.</p>
<p><img src="http://community.activestate.com/files/images/svn_blame.png" alt="svn blame image" /></p>
Is enabled.. (cookie, javascript & java)? (JavaScript)
2013-03-19T11:23:28-07:00greg zakharovhttp://code.activestate.com/recipes/users/4184115/http://code.activestate.com/recipes/578495-is-enabled-cookie-javascript-java/
<p style="color: grey">
JavaScript
recipe 578495
by <a href="/recipes/users/4184115/">greg zakharov</a>
(<a href="/recipes/tags/cookie/">cookie</a>, <a href="/recipes/tags/java/">java</a>, <a href="/recipes/tags/javascript/">javascript</a>).
</p>
<p>I'm not sure that the following method is universal in all cases to detect is enabled or disabled cookie, javascript and java in user browser at current moment. This is just an example.</p>
WebSocket interface (Python)
2012-11-25T16:52:21-08:00Nick Farohttp://code.activestate.com/recipes/users/4184363/http://code.activestate.com/recipes/578348-websocket-interface/
<p style="color: grey">
Python
recipe 578348
by <a href="/recipes/users/4184363/">Nick Faro</a>
(<a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/network/">network</a>, <a href="/recipes/tags/socket/">socket</a>, <a href="/recipes/tags/websocket/">websocket</a>).
Revision 2.
</p>
<p>This tries its best to be a replacement for the regular <code>socket</code> module.</p>
<p>It supports only sending and receiving but should be useful enough.</p>
<p>The only real difference should be that you can't specify the number of bytes is received, instead do</p>
<pre class="prettyprint"><code>for message in socket.recv():
print(message)
</code></pre>
<p>Revision 2:
Added proper message receiving. Previously it just requested a ton of data. Now it reads 2 bytes, determines the length, then requests that much.</p>
Komodo JS Macro - Copy all "Find Results 1" data into a new editor window (JavaScript)
2014-07-03T15:18:03-07:00Dave Waldhttp://code.activestate.com/recipes/users/4181625/http://code.activestate.com/recipes/578100-komodo-js-macro-copy-all-find-results-1-data-into-/
<p style="color: grey">
JavaScript
recipe 578100
by <a href="/recipes/users/4181625/">Dave Wald</a>
(<a href="/recipes/tags/findresults/">findresults</a>, <a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>).
Revision 5.
</p>
<p>Gets the Find Results Manager for the "Find Results 1" tab, if it exists.
If the tab has rows in it, then copies out all the data from each row and adds it to an output buffer.
Creates a new editor view (or optionally reuses the existing one) and appends the output buffer to it.
Note: Be sure to see Bruno's update below, until I get it merged in. ;)</p>
Macro to Quick find (ctrl+f3) on double click (JavaScript)
2011-07-22T07:46:26-07:00Adamhttp://code.activestate.com/recipes/users/4173315/http://code.activestate.com/recipes/577801-macro-to-quick-find-ctrlf3-on-double-click/
<p style="color: grey">
JavaScript
recipe 577801
by <a href="/recipes/users/4173315/">Adam</a>
(<a href="/recipes/tags/editor/">editor</a>, <a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/scintilla/">scintilla</a>).
Revision 3.
</p>
<p>This does a search for the selected word when you double click it. Functionality similar to Notepad++. Faster that ctrl-f3.</p>
Revisiting "Revenge of the auto-wrap": Another toggle-macro (JavaScript)
2010-10-04T23:51:41-07:00Eric Promislowhttp://code.activestate.com/recipes/users/4166930/http://code.activestate.com/recipes/577417-revisiting-revenge-of-the-auto-wrap-another-toggle/
<p style="color: grey">
JavaScript
recipe 577417
by <a href="/recipes/users/4166930/">Eric Promislow</a>
(<a href="/recipes/tags/autowrap/">autowrap</a>, <a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/togglemacro/">togglemacro</a>).
Revision 2.
</p>
<p>Komodo doesn't automatically wrap lines when they reach a certain length, which is a good trait to have in a code editor. However, for those times where you're editing non-code, it can be helpful to have newlines inserted automatically. Troy Topnik addressed this problem a couple of years ago, in his post <a href="http://www.activestate.com/blog/2008/11/revenge-auto-wrap-type-type-type-ding" rel="nofollow">http://www.activestate.com/blog/2008/11/revenge-auto-wrap-type-type-type-ding</a> . As Komodo 6 heads out the door, I've been writing blog posts, and found this feature useful. But his solution used two macros. I put my coding hat back on, and reimplemented it as a "toggle macro".</p>
Komodo JS Macro - use vertical editor tabs positioned to the right (JavaScript)
2010-09-10T02:53:33-07:00Todd Whitemanhttp://code.activestate.com/recipes/users/2666241/http://code.activestate.com/recipes/577386-komodo-js-macro-use-vertical-editor-tabs-positione/
<p style="color: grey">
JavaScript
recipe 577386
by <a href="/recipes/users/2666241/">Todd Whiteman</a>
(<a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/layout/">layout</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/tab/">tab</a>).
</p>
<p>A <a href="http://www.activestate.com/komodo-ide">Komodo</a> JavaScript macro that can be used to position the editor tabs on the right side and shown vertically.</p>
<p>Additional layouts (left, right, up, down, vertical, horizontal) can be made with different combinations, see here for the Mozilla tabbox positioning documentation:
<a href="https://developer.mozilla.org/en/XUL_Tutorial/Tabboxes#Position_of_the_tabs" rel="nofollow">https://developer.mozilla.org/en/XUL_Tutorial/Tabboxes#Position_of_the_tabs</a></p>
Komodo JS Macro - delete marked lines (JavaScript)
2010-08-30T17:32:24-07:00Eric Promislowhttp://code.activestate.com/recipes/users/4166930/http://code.activestate.com/recipes/577378-komodo-js-macro-delete-marked-lines/
<p style="color: grey">
JavaScript
recipe 577378
by <a href="/recipes/users/4166930/">Eric Promislow</a>
(<a href="/recipes/tags/bookmarks/">bookmarks</a>, <a href="/recipes/tags/editor/">editor</a>, <a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/komodo/">komodo</a>).
</p>
<p>You can set bookmarks in Komodo, for ease ni revisiting certain lines. This recipe lets you
delete all the marked lines in the current buffer. This code is undoable, but the markers
are gone for good. They aren't restored by Scintilla, and having Komodo restore them
would be a pain.</p>
Komodo JS Macro - insert a relative path from the current editor file (JavaScript)
2012-02-24T00:23:09-08:00Todd Whitemanhttp://code.activestate.com/recipes/users/2666241/http://code.activestate.com/recipes/577306-komodo-js-macro-insert-a-relative-path-from-the-cu/
<p style="color: grey">
JavaScript
recipe 577306
by <a href="/recipes/users/2666241/">Todd Whiteman</a>
(<a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/path/">path</a>, <a href="/recipes/tags/relative/">relative</a>).
Revision 3.
</p>
<p>A <a href="http://www.activestate.com/komodo">Komodo</a> JavaScript macro that can be used to generate a relative path from the current editor file location, which works great for HTML when linking to relative style sheets, images, etc...</p>
<p>Upon execution of this macro, you will be prompted to browse and select the target file, then upon selecting the target path, the relative path location will be inserted into the editor at the current position.</p>
<p>To best use this macro - assign a custom key-binding to the macro and then trigger the macro at will.</p>
Komodo JS Macro - Search word under cursor (no need to select it) (JavaScript)
2010-03-30T16:41:00-07:00Davide Ficanohttp://code.activestate.com/recipes/users/4166571/http://code.activestate.com/recipes/577169-komodo-js-macro-search-word-under-cursor-no-need-t/
<p style="color: grey">
JavaScript
recipe 577169
by <a href="/recipes/users/4166571/">Davide Ficano</a>
(<a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>).
</p>
<p>Search word under cursor (no need to select it).
If no word it is possible to determine (eg. cursor is near a bracket) search by the last used find pattern</p>
Komodo JS Macro - force the focus back onto the editor after an alt-tab (JavaScript)
2010-03-29T18:59:03-07:00Todd Whitemanhttp://code.activestate.com/recipes/users/2666241/http://code.activestate.com/recipes/577164-komodo-js-macro-force-the-focus-back-onto-the-edit/
<p style="color: grey">
JavaScript
recipe 577164
by <a href="/recipes/users/2666241/">Todd Whiteman</a>
(<a href="/recipes/tags/focus/">focus</a>, <a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/setfocus/">setfocus</a>, <a href="/recipes/tags/tab/">tab</a>, <a href="/recipes/tags/window/">window</a>).
</p>
<p>A <a href="http://www.activestate.com/komodo">Komodo</a> JavaScript macro that can be used to force the focus back to the Komodo editor after switching between windows (i.e. after using Alt-Tab).</p>
<p>This macro only applies to Windows and Mac OS - where there is an application activated notification event available.</p>
<p>To use this macro - set the macro to trigger on the "On startup" event.</p>
Komodo JS Macro - increase the number of code completion items shown (JavaScript)
2012-03-15T23:20:25-07:00Todd Whitemanhttp://code.activestate.com/recipes/users/2666241/http://code.activestate.com/recipes/577163-komodo-js-macro-increase-the-number-of-code-comple/
<p style="color: grey">
JavaScript
recipe 577163
by <a href="/recipes/users/2666241/">Todd Whiteman</a>
(<a href="/recipes/tags/codeintel/">codeintel</a>, <a href="/recipes/tags/completions/">completions</a>, <a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/toddw/">toddw</a>).
Revision 2.
</p>
<p>A <a href="http://www.activestate.com/komodo">Komodo</a> JavaScript macro that can be used to set the number of code completion items shown in the list.</p>
<p>If you set the macro to Trigger on the Komodo "After file open" event - then this setting will be always be applied to every file code completion list.</p>
Komodo JS Macro - move current line down one (JavaScript)
2010-03-10T12:25:06-08:00Eric Promislowhttp://code.activestate.com/recipes/users/4166930/http://code.activestate.com/recipes/577101-komodo-js-macro-move-current-line-down-one/
<p style="color: grey">
JavaScript
recipe 577101
by <a href="/recipes/users/4166930/">Eric Promislow</a>
(<a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/komodo/">komodo</a>).
</p>
<p>This Komodo macro moves the line containing the caret (cursor) down one line,
and then puts the caret at the start of that line in its new position.
Put the macro in your toolbox, and bind it to Ctrl-Shift-DownpArrow
(unused in the default Komodo keybinding set) to get the same
functionality as in some other popular editors).</p>
Komodo JS Macro - move current line up one (JavaScript)
2010-03-10T12:24:43-08:00Eric Promislowhttp://code.activestate.com/recipes/users/4166930/http://code.activestate.com/recipes/577100-komodo-js-macro-move-current-line-up-one/
<p style="color: grey">
JavaScript
recipe 577100
by <a href="/recipes/users/4166930/">Eric Promislow</a>
(<a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/komodo/">komodo</a>).
</p>
<p>This Komodo macro moves the line containing the caret (cursor) up one line,
and then puts the caret at the start of that line in its new position.
Put the macro in your toolbox, and bind it to Ctrl-Shift-UpArrow
(unused in the default Komodo keybinding set) to get the same
functionality as in some other popular editors).</p>
A Komodo macro for duplicating the current file (Komodo 5 only!) (JavaScript)
2011-02-03T23:45:02-08:00Eric Promislowhttp://code.activestate.com/recipes/users/4166930/http://code.activestate.com/recipes/577085-a-komodo-macro-for-duplicating-the-current-file-ko/
<p style="color: grey">
JavaScript
recipe 577085
by <a href="/recipes/users/4166930/">Eric Promislow</a>
(<a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/komodo/">komodo</a>).
</p>
<p>Komodo projects look like file managers, but don't always offer the same functionality directly.
Here's a macro that makes a copy of the current selected file in a project. To use it,
create a new macro in the Komodo toolbox, copy this code, paste it in the macro, and save it.
Then you can select a file, double-click the macro icon (or assign it to a keybinding),
and Komodo will create a copy of the file called "Copy of <basename>.<extension>".</p>
Komodo JS Macro - show svn blame for the current editor line (JavaScript)
2013-05-02T22:28:50-07:00Todd Whitemanhttp://code.activestate.com/recipes/users/2666241/http://code.activestate.com/recipes/577013-komodo-js-macro-show-svn-blame-for-the-current-edi/
<p style="color: grey">
JavaScript
recipe 577013
by <a href="/recipes/users/2666241/">Todd Whiteman</a>
(<a href="/recipes/tags/blame/">blame</a>, <a href="/recipes/tags/javascript/">javascript</a>, <a href="/recipes/tags/komodo/">komodo</a>, <a href="/recipes/tags/macro/">macro</a>, <a href="/recipes/tags/scc/">scc</a>, <a href="/recipes/tags/subversion/">subversion</a>, <a href="/recipes/tags/svn/">svn</a>, <a href="/recipes/tags/toddw/">toddw</a>).
Revision 4.
</p>
<p>A <a href="http://www.activestate.com/komodo">Komodo</a> JavaScript macro that can show the SCC repository information for who last changed the current line in the Komodo editor - see the screenshot below.</p>
<p><img src="http://community.activestate.com/files/images/svn_blame.png" alt="svn blame image" /></p>