- Create
UNLOGGEDtable. This reduces the amount of data written to persistent storage by up to 2x. - Set
WITH (autovacuum_enabled=false)on the table. This saves CPU time and IO bandwidth on useless vacuuming of the table (since we neverDELETEorUPDATEthe table). - Insert rows with
COPY FROM STDIN. This is the fastest possible approach to insert rows into table. - Minimize the number of indexes in the table, since they slow down inserts. Usually an index
on
time timestamp with time zoneis enough. - Add
synchronous_commit = offtopostgresql.conf. - Use table inheritance for fast removal of old 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 compose(...fnArgs) { | |
| const [first, ...funcs] = fnArgs.reverse(); | |
| return function(...args) { | |
| return funcs.reduce((res, fn) => fn(res), first(...args)); | |
| }; | |
| } |
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 getData() { | |
| var deferred = $.Deferred(); | |
| $.ajax({ | |
| 'url': 'http://google.com', | |
| 'success': function(data) { | |
| deferred.resolve('yay'); | |
| }, | |
| 'error': function(error) { | |
| deferred.reject('boo'); |
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
| <!DOCTYPE html> | |
| <html lang="fr"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>Title</title> | |
| <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> | |
| </head> | |
| <body> |
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 data = { | |
| "name": "root", | |
| "contents": [ | |
| { | |
| "name": "A", | |
| "contents": [ | |
| { | |
| "name": "fileA1", | |
| "contents": [] | |
| } |
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
| <?php | |
| //Larger images can require more memory and time | |
| ini_set('memory_limit','2048M'); | |
| ini_set('max_execution_time','300'); | |
| //For testing purposes, I manually entered the input file name and destination folder | |
| $destinationDir = 'tiles/'; | |
| $fileName = 'map.jpg'; | |
| if (!file_exists($destinationDir)) { |
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
| /* HAS ATTRIBUTE */ | |
| $.fn.hasAttr = function(attrName){ | |
| var element = this[0]; | |
| if(element.hasAttribute){ | |
| return element.hasAttribute(attrName); |
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
| <!DOCTYPE html> | |
| <html><head> | |
| <meta charset="utf-8"> | |
| <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> | |
| <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> | |
| <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> | |
| <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script> | |
| </head><body> | |
| <div class="container"><span class="btn btn-success"><i class="fa fa-coffee"></i></span></div> | |
| </body></html> |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> | |
| <meta charset="UTF-8"> | |
| <title>Drawing Tools</title> | |
| <script type="text/javascript" | |
| src="http://maps.google.com/maps/api/js?sensor=false&libraries=drawing"></script> | |
| <style type="text/css"> | |
| #map, html, body { |
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
| /** | |
| * Stop propagation behavior for scroll of the element but body. | |
| * Compatibility: IE9+ | |
| * Ref: | |
| * - http://stackoverflow.com/questions/5802467/prevent-scrolling-of-parent-element#answer-16324762 | |
| * - https://developer.mozilla.org/en-US/docs/Web/Events/wheel | |
| */ | |
| ;(function ($) { | |
| $.fn.scrollable = function () { | |
| this.on('wheel', function (event) { |