Simple class to make smooth scroll to make fully visible givien item inside a container.
Example:
| #!/usr/bin/env php | |
| <?php | |
| class morse {/*{{{*/ | |
| private $a2m; | |
| private $m2a; | |
| private $sep; | |
| private $lang; | |
| public function __construct(/*{{{*/ |
| "use strict" | |
| var myArray = (function(Array) { // Array with steroids.//{{{ | |
| // Implement an Array clone with extended functions. | |
| // In only imlements a simple .contains() method, but can be extended to | |
| // add many more. | |
| // The main key feature is the ability to do this WITHOUT | |
| // altering the original Array object in any way. | |
| // NOTE: Now we should use the myArray object to declare it. Main goal | |
| // is to implement it as "var Array = (function(arr){...})(Array);" |
| // Implement .back-btn class bassed (self-explainatory) functionality for anchors. | |
| $(".back-btn").each(function(){ | |
| var btn = $(this); // me (.back-btn) | |
| var pageId = btn.closest("div[data-role='page']").attr("id"); // My page id. | |
| $('a[href="#' + pageId + '"]').each(function(){ // Anchors linking my page. | |
| var srcLink = $(this); | |
| var srcPageId = srcLink.closest("div[data-role='page']").attr("id"); // Their page id. | |
| // Awesome magic!! ;-) |
| // Handy plv8 console object (debugging) | |
| var console = (function(){ | |
| var columns = 100; | |
| function logString(level, str) { | |
| var chunk = str.substring(0, columns); | |
| var overflow = str.substring(columns); | |
| plv8.elog(level, chunk); | |
| if (overflow.length) logString(level, " | "+overflow); | |
| }; |
| var _debug = true;var pg = (function(_debug){ // Our enhanced plv8 object.//{{{ | |
| if (! _debug) return { | |
| prepare: plv8.prepare, | |
| log: function(){}, | |
| }; | |
| function gett() { | |
| return parseInt(plv8.execute("select EXTRACT(EPOCH FROM (clock_timestamp()))*100000 as t")[0].t); | |
| }; |
Simple class to make smooth scroll to make fully visible givien item inside a container.
Example:
| // Exapmle var foo = intersect({foo: [1, 2, 5, 8], bar: {two: 2, tree: 3, four: 4, five: 5, six: 6}}); | |
| function intersect (arrList) { // Calculate intersection of multiple array or object values: //{{{ | |
| var l = Object.keys(arrList).length; // Also accepts regular objects as input. | |
| var index = {}; | |
| for (var i in arrList) { | |
| for (var j in arrList[i]) { | |
| var v = arrList[i][j]; |
| // document dialogs overload: | |
| // ========================== | |
| // | |
| // WARNING: This javascript versions CAN'T stop rest of javascript processing (except by an infinite | |
| // loop which will also block this dialogs functionalities). | |
| // | |
| // I tryed to implement a "non-self-blocking" internal loop but need a nextTick() function which is | |
| // not available on most (if not all) browser javascript implementations. | |
| // | |
| // I tryed to emulate it using ontimeout()'s and other tricks, but it doesn't work anyway. |
| /* public.plv8_startup() | |
| * | |
| * Allow to have multiple per-schema plv8_init functions. | |
| * | |
| * USAGE: | |
| * | |
| * 1. Add the following line to the end of your postgresql.conf file: | |
| * | |
| * plv8.start_proc = 'public.plv8_startup' | |
| * |
| "use strict"; | |
| var stack = (function(){ | |
| function _stack(){ | |
| this.stack = []; | |
| this.queue = []; | |
| }; | |
| _stack.prototype.push = function stack_push(data){ |