This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var rowlength = Array.prototype.reduce.call(document.querySelectorAll('.items-on-sale-not-empty-slot'), function (prev, next) { | |
| if (!prev[2]) { | |
| var ret = next.getBoundingClientRect().left | |
| // if increasing, increment counter | |
| if (!(prev[0] > -1 && ret < prev[1])) { prev[0]++ } | |
| else { prev[2] = 1 } // else stop counting | |
| } | |
| return [prev[0], ret, prev[2]] // [counter, elem, stop-counting] | |
| }, [0, null, 0])[0]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Node code: | |
| ========================================= | |
| var crypto = require('crypto'); | |
| const { generateKeyPair } = require('crypto'); | |
| // generate private/public secret keys if you need | |
| generateKeyPair('rsa', { | |
| modulusLength: 2048, | |
| publicKeyEncoding: { | |
| type: 'spki', | |
| format: 'pem' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * @param prepared capsule(eloquent) object | |
| * use: capsuleToSql( | |
| $capsuleObject->select('*') | |
| ->orderBy('created_date', 'desc')); | |
| */ | |
| public function capsuleToSql($preparedForGetQuery) { | |
| Capsule::connection()->enableQueryLog(); | |
| $preparedForGetQuery->get(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require_once 'phpQuery/phpQuery.php'; | |
| $str = file_get_contents('source_url'); | |
| $pq = phpQuery::newDocument($str); | |
| $links = $pq->find('.body a > img'); //like jquery tags | |
| foreach ($links as $link) { | |
| $pqLink = pq($link); //pq make phpQuery object | |
| $src[] = $pqLink->attr('src'); | |
| } | |
| for($i=0;$i<count($src);$i++){ | |
| $tmp = $src[$i]; //get file name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery.ajax({ | |
| url: '/url', | |
| type: 'post', | |
| data: { | |
| filed1: 'value1', | |
| }, | |
| dataType: 'json', | |
| success: function(data){ | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function() { | |
| /** | |
| * @class custom | |
| */ | |
| var exampleClass = { | |
| config: {}, | |
| data: {}, | |
| init: function(data) | |
| { | |
| v.data = data; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Array.prototype.unique = function(){ | |
| var u = {}, a = []; | |
| for(var i = 0, l = this.length; i < l; ++i){ | |
| if(u.hasOwnProperty(this[i])) { | |
| continue; | |
| } | |
| a.push(this[i]); | |
| u[this[i]] = 1; | |
| } | |
| return a; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT threadid, userid, groupid, COUNT( ID ) | |
| FROM forum_users | |
| GROUP BY forum_users.threadid, forum_users.userid, forum_users.groupid | |
| HAVING COUNT( forum_users.ID ) >1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function($){ | |
| $.fn.myParallax = function(){ | |
| return this.each(function(){ | |
| var ths = $(this); | |
| }); | |
| } | |
| })(jQuery); |